Running dotnet build -f net46 builds and packages packages that contain all frameworks
See original GitHub issuefrom @niemyjski at https://github.com/dotnet/cli/issues/5595
So I was running into tons of issues that have been fixed in the nightlies and just wanted to build and package only .net 46 framework targets so I ran the build with -f net46
https://github.com/exceptionless/Foundatio/blob/master/appveyor.yml#L23
But it appears that the nuget package were still built and completed as full framework and net standard targets.
https://www.nuget.org/packages/Foundatio/
I expected the netstandard build and packaging not to take place (I also haven’t looked inside the nuget package yet to see what is in the net standard folder).
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (16 by maintainers)
Top Results From Across the Web
dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >How to build multi-target solution on .NET Core on Mac or ...
This allows specifying netstandard* and netcoreapp* for non-windows individually for all projects and the .net core only versions of your app ...
Read more >Multi-targetting .Net Framework and .Net Core in a single project
If you dotnet pack a multi-targeting project, you see it builds all targets, and puts them all in a single nuget package. What...
Read more >Untitled
Running dotnet build -f net46 builds and packages packages ... - Github Install the .NET Framework developer pack or redistributable Web1 thg 5, ......
Read more >Msbuild not found. This is due to your VCTargetsPath path ...
Msbuild not found. This is due to your VCTargetsPath path variable … 08/05/2021 1 contributor Feedback This error occurs when an MSBuild project...
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
@niemyjski see my comment https://github.com/dotnet/sdk/issues/825#issuecomment-278359578 for explanation
@piotrpMSFT @niemyjski Ok… I just played a little with this :
If my project has
TargetFrameworks=net46;netstandard1.4
set along withGeneratePackageOnBuild = true
, and I rundotnet build -f net46
this will actually not end up creating the package at all. This is because the only way in Pack targets that we differentiate an inner build from an outer build is using the condition :<IsInnerBuild Condition="'$(TargetFramework)' != '' AND '$(TargetFrameworks)' != ''">true</IsInnerBuild>
.Since
dotnet build -f net46
is equivalent to callingdotnet build /p:TargetFramework=net46
, it causes pack to think of outer build as inner build too, and therefore it doesn’t execute at all.If instead I run
dotnet build /p:TargetFrameworks=net46
; then I get the results i expect, the build only builds for the net46 framework and pack only packs the net46 assemblies.Maybe we need to modify the framework switch to pass in TargetFrameworks instead of TargetFramework?