A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/dotnet/core/tutorials/publishing-with-visual-studio below:

Publish a .NET console application using Visual Studio - .NET

This tutorial shows how to publish a console app so that other users can run it. Publishing creates the set of files that are needed to run your application. To deploy the files, copy them to the target machine.

Prerequisites Publish the app
  1. Start Visual Studio.

  2. Open the HelloWorld project that you created in Create a .NET console application using Visual Studio.

  3. Make sure that Visual Studio is using the Release build configuration. If necessary, change the build configuration setting on the toolbar from Debug to Release.

  4. Right-click on the HelloWorld project (not the HelloWorld solution) and select Publish from the menu.

  5. On the Target tab of the Publish page, select Folder, and then select Next.

  6. On the Specific Target tab of the Publish page, select Folder, and then select Next.

  7. On the Location tab of the Publish page, select Finish.

  8. On the Publish profile creation progress page, select Close.

  9. On the Publish tab of the Publish window, select Publish.

Inspect the files

By default, the publishing process creates a framework-dependent deployment, which is a type of deployment where the published application runs on a machine that has the .NET runtime installed. Users can run the published app by double-clicking the executable or issuing the dotnet HelloWorld.dll command from a command prompt.

In the following steps, you'll look at the files created by the publish process.

  1. In Solution Explorer, select Show all files.

  2. In the project folder, expand bin/Release/net7.0/publish.

    As the image shows, the published output includes the following files:

Run the published app
  1. In Solution Explorer, right-click the publish folder, and select Copy Full Path.

  2. Open a command prompt and navigate to the publish folder. To do that, enter cd and then paste the full path. For example:

    cd C:\Projects\HelloWorld\bin\Release\net8.0\publish\
    
  3. Run the app by using the executable:

    1. Enter HelloWorld.exe and press Enter.

    2. Enter a name in response to the prompt, and press any key to exit.

  4. Run the app by using the dotnet command:

    1. Enter dotnet HelloWorld.dll and press Enter.

    2. Enter a name in response to the prompt, and press any key to exit.

Additional resources Next steps

In this tutorial, you published a console app. In the next tutorial, you create a class library.

Create a .NET class library using Visual Studio


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4