Microsoft.NET.publish.targets does not respect property PublishableProject
See original GitHub issueIn 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:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What I wish to be able to do is run
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:
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.
I have a solution with a class library project having
TargetFrameworks
(multiple) defined. If I calldotnet 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
toTargetFramework
the error is gone – therefore my guess is thatIsPublishable
property gets checked too late.My
dotnet.exe --version
shows 3.1.100.