Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet publish only one project from the solution in VSTS

We are trying to build one project from a Visual Studio solution in VSTS with .NET Core task. We are able to "dotnet build" that project. But when we try to "dotnet publish" it tries to publish all projects from the solution. Even if we use "dotnet custom", it tries to publish all projects.

Is there a way to use .NET Core task to publish only one project or projects that were built? Or should we run a custom command line task?

Reason for this is that we have a project that won't build and we don't need/want to publish it. So we would like to build and publish one project and not all projects.

Screenshot from VSTS

like image 306
Lassi Autio Avatar asked Sep 03 '18 06:09

Lassi Autio


2 Answers

You can use dotnet publish <Path to .csproj>. This will build and publish only the specified project and projects it depends on.

In order to specify a project in the '.Net Core' task with the command 'publish' you have to uncheck 'Publish Web Projects'.

like image 107
renklus Avatar answered Sep 30 '22 02:09

renklus


If you un-check the 'Publish Web Projects' you will see a field appear that allows you to enter the project (csproj) you want to target.

like image 42
Ben D Avatar answered Sep 30 '22 03:09

Ben D