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:
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.
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.
Open a console window. For example in the Type here to search text box in the Windows taskbar, enter
cmdfor 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.
Navigate to the published application in the
bin\release\PublishOutputsubdirectory of your application's project directory. As the following figure shows, the published output includes the following four files:
- HelloWorld.pdb (optional for deployment)
The HelloWorld.pdb file 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.
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.