A RetroSearch Logo

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

Search Query:

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

Publish a .NET console application using Visual Studio Code - .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 an application. To deploy the files, copy them to the target machine.

The .NET CLI is used to publish the app, so you can follow this tutorial with a code editor other than Visual Studio Code if you prefer.

Prerequisites Publish the app
  1. Start Visual Studio Code.

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

  3. Choose View > Terminal from the main menu.

    The terminal opens in the HelloWorld folder.

  4. Run the following command:

    dotnet publish
    

    The default build configuration is Release, which is appropriate for a deployed site running in production. The output from the Release build configuration has minimal symbolic debug information and is fully optimized.

    The command output is similar to the following example:

    Microsoft (R) Build Engine version 17.8.0+b89cb5fde for .NET
    Copyright (C) Microsoft Corporation. All rights reserved.
      Determining projects to restore...
      All projects are up-to-date for restore.
      HelloWorld -> C:\Projects\HelloWorld\bin\Release\net8.0\HelloWorld.dll
      HelloWorld -> C:\Projects\HelloWorld\bin\Release\net8.0\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. To run the published app you can use the executable file or run 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. Select the Explorer in the left navigation bar.

  2. Expand bin/Release/net8.0/publish.

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

Run the published app
  1. In Explorer, right-click the publish folder (Ctrl-click on macOS), and select Open in Integrated Terminal.

  2. On Windows or Linux, run the app by using the executable.

    1. On Windows, enter .\HelloWorld.exe and press Enter.

    2. On Linux, enter ./HelloWorld and press Enter.

    3. Enter a name in response to the prompt, and press Enter to exit.

  3. On any platform, 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 Enter 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 Code


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