Visual Studio For Mac Publish Console App
-->
- Visual Studio Code Console App
- Visual Studio Publish Web
- Visual Studio For Mac Publish Console Application
- Visual Studio For Mac Publish Console App 2017
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.
After quite a bit of experimentation and research, I've found that while you can publish a.NET Core Console App within Visual Studio for Mac, the feature is not supported within the GUI of the program (for whatever reason).

Prerequisites

- This tutorial works with the console app that you create in Create a .NET Core console application in Visual Studio 2019.
Publish the app
Start Visual Studio.
Open the HelloWorld project that you created in Create a .NET Core console application in Visual Studio.
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.
Right-click on the HelloWorld project (not the HelloWorld solution) and select Publish from the menu.
On the Target tab of the Publish page, select Folder, and then select Next.
On the Location tab of the Publish page, select Finish.
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 machine that has the .NET Core 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.
In Solution Explorer, select Show all files.
In the project folder, expand bin/Release/netcoreapp3.1/publish.
As the image shows, the published output includes the following files:
HelloWorld.deps.json
This is 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 the app. For more information, see Runtime configuration files.
HelloWorld.dll
This is the framework-dependent deployment version of the application. To execute this dynamic link library, enter
dotnet HelloWorld.dll
at a command prompt. This method of running the app works on any platform that has the .NET Core runtime installed.HelloWorld.exe
This is the framework-dependent executable version of the application. To run it, enter
HelloWorld.exe
at a command prompt. The file is operating-system-specific.HelloWorld.pdb (optional for deployment)
This is the debug symbols file. 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
This is the application's run-time configuration file. It identifies the version of .NET Core that your application was built to run on. You can also add configuration options to it. For more information, see .NET Core run-time configuration settings.
Run the published app
In Solution Explorer, right-click the publish folder, and select Copy Full Path.
Open a command prompt and navigate to the publish folder. To do that, enter
cd
and then paste the full path. For example:Run the app by using the executable:
Enter
HelloWorld.exe
and press Enter.Enter a name in response to the prompt, and press any key to exit.
Run the app by using the
dotnet
command:Enter
dotnet HelloWorld.dll
and press Enter.Enter a name in response to the prompt, and press any key to exit.
Additional resources
Next steps
Visual Studio Code Console App
In this tutorial, you published a console app. In the next tutorial, you create a class library.
-->You can use the Publish tool to publish .NET Core Console or ASP.NET Core apps to a folder.
Prerequisites
- Visual Studio 2019 for Mac installed with .NET Core enabled.
- A .NET Core console or ASP.NET Core project. If you don’t already have a project, you can create a new one.
Publish to Folder
Using Visual Studio for Mac you can publish your .NET Core projects to a folder using the Publish tool. After publishing to a folder you can transfer the files to a different environment. To publish to a folder follow these steps.
In the Solution Pad, right-click the project and choose Publish.
If you have previously published this project, you'll see the publish profile in the menu. Select that publish profile to start the publish process.
To publish this project to a folder for the first time, select Publish to Folder
The Publish to Folder dialog appears. On this dialog you can customize the folder where the project will be published. You can use the Browse button to do this, or paste in a path.
After clicking Publish a few things happen. First a publish profile is created. A publish profile is an MSBuild file that is imported into the project during the publish process. It contains the properties that are used during the publish process. These files are stored in the
Properties/PublishProfiles
and have the extension.pubxml
. Next, the publish process is started. You can monitor the progress by watching the status bar in Visual Studio for Mac.Once publish completes successfully a Finder window will open to the publish folder. Now that a publish profile has been created, it will be displayed in the Publish context menu.
To publish the project again with the same settings you can click on the profile in the publish context menu.
Visual Studio Publish Web
Customize Publish Options
To change the name of the publish profile (which is displayed in the publish context menu), rename the publish profile file. Make sure to not change the extension of the file (.pubxml
).
Visual Studio For Mac Publish Console Application
To change the publish folder path, open the publish profile and edit the publishUrl
value.
Visual Studio For Mac Publish Console App 2017
To change the build configuration that is used, change the LastUsedBuildConfiguration
property in the publish profile.