First published on MSDN on May 22, 2018
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
Container Orchestrator Support
. This will display a dialog box where you select
(Click image below to start video)
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.