The latest version of the Service Fabric tools, which is part of Visual Studio 2017 Update 7 (15.7), includes the new container tooling for Service Fabric feature. This new feature makes debugging and deploying existing applications, in containers, on Service Fabric easier than ever before.
Containerize .NET Framework and .NET Core applications and run them on Service Fabric
You can now take an existing console or ASP.NET application, deploy it to a container image, and run and debug it in Service Fabric as a container on your local developer workstation. With a few clicks, you can make your existing .NET application run in a container in a Service Fabric environment. Simply right-click on your project in Solution Explorer and selecting Add –> Container Orchestrator Support. This will display a dialog box where you select Service Fabric and click OK.
Doing this will create a Docker file in your project and add the required Service Fabric files, as well as create a new Service Fabric application project in the solution. If your project is part of a solution with an existing Service Fabric application, it will be added to that application automatically. This must be done for each project in the solution you want to containerize for Service Fabric.
Debug containers running on Service Fabric
Not only can you easily containerize existing .NET projects with just a few clicks, you can also debug the code running inside the container instance as it runs in Service Fabric. Hit F5 and you will get full debugging support within Visual Studio for each service, even when it runs in a container! For the best debugging experience, use a one node cluster and “Refresh Application” mode.
Publish your containerized application to Service Fabric
When it's time to publish your application to Azure, the Publish dialog in Visual Studio will prompt you for an Azure Container Registry (ACR) to push your image(s) to, as well as the cluster connection information.
We have also updated the Visual Studio Team Services tasks for Service Fabric, to support the above scenario: Deploy: Service Fabric Application Deployment.
To learn more about how to be setup and use the tools, take a look at these articles:
- How to: Debug Windows containers in Azure Service Fabric using Visual Studio 2017
- Tutorial: Deploy a .NET application in a Windows container to Azure Service Fabric
- ASP.NET lift and shift with container and Service Fabric lab
From all of us…
The Service Fabric and Visual Studio teams
Source: Azure Blog Feed