Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "dotnet publish" with a pubxml file?

Tags:

.net-core

I have a .net Core application and some pubxml files. When I publish from Visual Studio, it works. But I cannot figure out how to publish from the command line.

This question does not help:

  • dotnet publish -c Release MyApp /p:PublishProfile=MyApp\Properties\PublishProfiles\Win64.pubxml publishes a portable version
  • Going into the MyApp folder does not help either
  • The linked question has a link to a Github issue but this is about msbuild, I want to use dotnet publish.

What am I missing?

like image 989
rabejens Avatar asked Oct 14 '25 18:10

rabejens


1 Answers

There is a newer answer on that other question that solves your question.

The short version is that you need to supply the path to the project and the path to the the pubxml file as arguments for dotnet publish.

dotnet publish .\pathToYourProject\projectFile.csproj --configuration Release /p:PublishProfile=.\pathToYourPubXmlFolder\PubProfile.pubxml

As noted there, this should work on Windows but doesn't on Linux.

like image 88
Taul Avatar answered Oct 17 '25 21:10

Taul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!