Publish your .NET Core Hello World application with Visual Studio 2017

In Build a C# Hello World application with .NET Core in Visual Studio 2017 or Build a Visual Basic Hello World application with .NET Core in Visual Studio 2017, you built a Hello World console application. In Debug your C# Hello World application with Visual Studio 2017, you tested it using the Visual Studio debugger. Now that you're sure that it works as expected, you can publish it so that other users can run it. Publishing creates the set of files that are needed to run your application, and you can deploy the files by copying them to a target machine.

To publish and run your application:

  1. Make sure that Visual Studio is building the Release version of your application. If necessary, change the build configuration setting on the toolbar from Debug to Release.

    Visual Studio toolbar with release build selected

  2. Right-click on the HelloWorld project (not the HelloWorld solution) and select Publish from the menu. You can also select Publish HelloWorld from the main Visual Studio Build menu.

    Visual Studio Publish context menu

    Visual Studio Publish window

  3. Open a console window. For example in the Type here to search text box in the Windows taskbar, enter Command Prompt (or cmd for short), and open a console window by either selecting the Command Prompt desktop app or pressing Enter if it's selected in the search results.

  4. Navigate to the published application in the bin\release\PublishOutput subdirectory of your application's project directory. As the following figure shows, the published output includes the following four files:

    • HelloWorld.deps.json

      The application's runtime dependencies file. It defines the .NET Core components and the libraries (including the dynamic link library that contains your application) needed to run your application. For more information, see Runtime Configuration Files.

    • HelloWorld.dll

      The file that contains your application. It is a dynamic link library that can be executed by entering the dotnet HelloWorld.dll command in a console window.

    • HelloWorld.pdb (optional for deployment)

      A file that contains debug symbols. You aren't required to deploy this file along with your application, although you should save it in the event that you need to debug the published version of your application.

    • HelloWorld.runtimeconfig.json

      The application's runtime configuration file. It identifies the version of .NET Core that your application was built to run on. For more information, see Runtime Configuration Files.

    Console window showing published files

The publishing process creates a framework-dependent deployment, which is a type of deployment where the published application will run on any platform supported by .NET Core with .NET Core installed on the system. Users can run your application by issuing the dotnet HelloWorld.dll command from a console window.

For more information on publishing and deploying .NET Core applications, see .NET Core Application Deployment.