Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet publish - set outputpath in csproj

I want to know if their is any tag to set the output path of the dotnet publish within the .csproj-file. I know I can use something along the lines of publish "someproject.csproj" --output "..\mypubfolder" from the command line. But I want to specify a (default) publish folder within the .csproj-file

like image 635
Duracell Avatar asked Mar 29 '18 07:03

Duracell


People also ask

How do I publish an entire solution in Visual Studio?

To publish from Visual Studio, do the following: Change the solution configuration from Debug to Release on the toolbar to build a Release (rather than a Debug) version of your app. Right-click on the project (not the solution) in Solution Explorer and select Publish. In the Publish tab, select Publish.

How do I change the build directory output?

Right-click on the project node in Solution Explorer and select Properties. Expand the Build section, and select the Output subsection. Find the Base output path for C#, and type in the path to generate output to (absolute or relative to the root project directory), or choose Browse to browse to that folder instead.

How do I publish my dotnet code?

To make publish output go to separate folders for each project, specify a relative path by using the msbuild PublishDir property instead of the --output option. For example, dotnet publish -p:PublishDir=. \publish sends publish output for each project to a publish folder under the folder that contains the project file.


1 Answers

You can set the PublishDir property which is used for the Publish target:

<PropertyGroup>
  <PublishDir>..\mypubfolder</PublishDir>
</PropertyGroup>
like image 65
Martin Ullrich Avatar answered Oct 03 '22 07:10

Martin Ullrich