question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Microsoft.NET.publish.targets does not respect property PublishableProject

See original GitHub issue

In Microsoft.Common.CurrentVersion.targets there is a Publish target that checks the property PublishableProject and determines if the current project should be published or not. Unfortunately Microsoft.NET.publish.targets overrides this and does not check the property.

This means that there is no way to prevent a project from being published. Note that the NuGet targets have an IsPackable property that can be set in the project to prevent it from producing a nuget package. It would be great to either use the PublishableProject or IsPublishable to have the same control when publishing.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mariusGundersencommented, Apr 1, 2017

What I wish to be able to do is run

dotnet publish mySolution.sln

And get only the projects that I have marked as publishable to be published. This way the build script can be very simple, since it can be roughly this:

dotnet clean mySolution.sln
dotnet restore mySolution.sln
dotnet build mySolution.sln
dotnet pack mySolution.sln
dotnet publish mySolution.sln
dotnet nuget push **/bin/**/*.nupkg
myCustomDeploy **/bin/**/publish

This is obviously a simplification, but not by much. Having the publishability be declaratively stated in the project rather than specified in the build script makes the build script simpler.

0reactions
StefanBertelscommented, Jan 15, 2020

I have a solution with a class library project having TargetFrameworks (multiple) defined. If I call dotnet publish (without any parameters) for my solution (containing e.g. a netcoreapp3.1 console app and this library project) it fails even if I define <IsPublishable>false</IsPublishable> in the class library’s csproj.

Everything else seems to work. If I change TargetFrameworks to TargetFramework the error is gone – therefore my guess is that IsPublishable property gets checked too late.

My dotnet.exe --version shows 3.1.100.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The 'Publish' target is not supported without specifying a ...
Sdk\buildCrossTargeting\Microsoft.NET.Sdk.targets(31,5): Error : The 'Publish' target is not supported without specifying a target framework.
Read more >
dotnet publish command - .NET CLI
The dotnet publish command calls MSBuild, which invokes the Publish target. If the IsPublishable property is set to false for a particular ...
Read more >
Publish ReadyToRun with --no-restore requires changes
Learn about the breaking change in .NET 6 where publishing a project with ReadyToRun requires changes to the way the project is restored....
Read more >
MSBuild reference for .NET SDK projects
The IsPublishable property allows the Publish target to run. This property only affects processes that use .*proj files and the Publish target, ...
Read more >
Publishing a DevExpress application results in the " ...
Hello, While trying to publish a .net core app which includes Asp.Net DevExpress packages, the publish fails and i see the following to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found