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.

Running dotnet build -f net46 builds and packages packages that contain all frameworks

See original GitHub issue

from @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:closed
  • Created 7 years ago
  • Comments:20 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
rohit21agrawalcommented, Feb 8, 2017
1reaction
rohit21agrawalcommented, Feb 8, 2017

@piotrpMSFT @niemyjski Ok… I just played a little with this :

If my project has TargetFrameworks=net46;netstandard1.4 set along with GeneratePackageOnBuild = true, and I run dotnet 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 calling dotnet 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?

Read more comments on GitHub >

github_iconTop 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 >

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