Use Visual Studio to create and publish .NET Core applications targeting a remote Linux Service Fabric cluster

With Visual Studio tooling you can develop and publish Service Fabric .NET Core applications targeting a Linux Service Fabric cluster. The SDK version must be 3.4 or above to deploy a .NET Core application targeting Linux Service Fabric clusters from Visual Studio.

Note

Visual Studio doesn't support debugging Service Fabric applications which target Linux.

Create a Service Fabric application targeting .NET Core

  1. Launch Visual Studio as an administrator.
  2. Create a project with File->New->Project.
  3. In the New Project dialog, choose Cloud -> Service Fabric Application. create-application
  4. Name the application and click Ok.
  5. On the New Service Fabric Service page, select the type of service you would like to create under the .NET Core Section. create-service

Deploy to a remote Linux cluster

  1. In the solution explorer, right click on the application and select Build. build-application
  2. Once the build process for the application has completed, right click on the service and choose to edit the csproj file. edit-csproj
  3. Edit the UpdateServiceFabricManifestEnabled property from True to False if the service is an actor project type. If your application does not have an actor service, skip to step 4.
    <UpdateServiceFabricManifestEnabled>False</UpdateServiceFabricManifestEnabled>

Note

Setting UpdateServiceFabricManifestEnabled to false, will disable updates to the ServiceManifest.xml during a build. Any change such as add, remove, or rename to the service will not be reflected in the ServiceManifest.xml. If any changes are made you must either update the ServiceManifest manually or temporarily set UpdateServiceFabricManifestEnabled to true and build the service that will update the ServiceManifest.xml and then revert it back to false.

  1. Update the RuntimeIndetifier from win7-x64 to the target platform in the service project.
    <RuntimeIdentifier>ubuntu.20.04-x64</RuntimeIdentifier>
  1. In the ServiceManifest, update the entrypoint program to remove .exe.
    <EntryPoint> 
    <ExeHost> 
        <Program>Actor1</Program> 
    </ExeHost> 
    </EntryPoint>
  1. In Solution Explorer, right-click on the application and select Publish. The Publish dialog box appears.
  2. In Connection Endpoint, select the endpoint for the remote Service Fabric Linux cluster that you would like to target. publish-application

Next steps