Docs: [2.0] Describe AssetTargetFallback

Created on 2 Aug 2017  路  10Comments  路  Source: dotnet/docs

Similar to the request to surface AssetTargetFallback in https://github.com/NuGet/docs.microsoft.com-nuget/issues/410, which was prompted by a discussion regarding PackageTargetFallback here, there are a few topics over here that might (probably) need a smidgen of work ... a note? a section? a replacement? versioned content? ... something to surface it:

https://docs.microsoft.com/en-us/dotnet/core/tools/csproj#packagetargetfallback
https://docs.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj#imports

Cross ref: Documenting .NET Core MSBuild targets and properties/CSPROJ (2642)

Area - .NET Core Guide P1 doc-enhancement

Most helpful comment

Created a PR to add some details of AssetTargetFallback to NuGet docs:
https://github.com/NuGet/docs.microsoft.com-nuget/pull/1264

All 10 comments

Note that especially when upgrading to 2.0, users might see this error if they have been using PackageTargetFallback:

error NU1003: PackageTargetFallback and AssetTargetFallback cannot be used together. Remove PackageTargetFallback(deprecated) references from the project environment.

see https://github.com/dotnet/cli/issues/6952.
TL;DR unless DisableImplicitAssetTargetFallback is set to true, .NET Core and .NET Standard >= 2.0 projects will implicitly have their AssetTargetFallback set to include net461 (see source).

The only docs I found are in a table at the bottom of https://github.com/NuGet/Home/wiki/Enable-.NET-Core-2.0-projects-to-work-with-.NET-Framework-4.6.1-compatible-packages

Some more context from https://github.com/dotnet/core/issues/711#issuecomment-312051242

by @rrelyea:

We have since improved that error to:
PackageTargetFallback is deprecated. Replace PackageTargetFallback references with AssetTargetFallback in the project environment.

More details...PackageTargetFallback worked like imports did in Project.json.
The teams have realized that our implementation of that wasn't ideal.
In order to not break old projects/packages -- we created AssetTargetFallback which is implicitly set for netcoreapp/netstandard2.0 projects via targets.
Some project templates, in the past, used PackageTargetFallback.
When upgrading those projects to v2.0, you end up with both PTF and ATF in effect. Thus we error.
Ideally, you just move to ATF from your existing PTF.

Thank you @guardrex and @dasMulli for the info. I'll try to squeeze this one in asap after I'm done with some other high pri work.

btw I put up a Q&A post on stack overflow back in august to at least have some info dealing with NU1003 there and it is still showing activity (visits/votes)
https://stackoverflow.com/questions/45569378/upgrading-to-net-core-2-0-packagetargetfallback-and-assettargetfallback-cannot/45569379

You see @mairaw why I nominated @dasMulli for MVP??!!

He's soooooo good that he can answer his own SO questions!

... well ... either that or he's a clone! :alien: :grinning:

Thanks guys! Sorry for the delay. 馃槩

raising priority as this has bumped several times.

btw in 15.8+ MSBuild will also honour the AssetTargetFallback value for P2P references - https://github.com/Microsoft/msbuild/pull/3205.

Please document AssetTargetFallback as soon as time allows.

Created a PR to add some details of AssetTargetFallback to NuGet docs:
https://github.com/NuGet/docs.microsoft.com-nuget/pull/1264

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skylerberg picture skylerberg  路  3Comments

LJ9999 picture LJ9999  路  3Comments

Manoj-Prabhakaran picture Manoj-Prabhakaran  路  3Comments

mekomlusa picture mekomlusa  路  3Comments

sdmaclea picture sdmaclea  路  3Comments