When restoring DotNetCliToolReferences, choose TargetFramework to restore with based on what the tool package targets #5067
Labels
Area:RestoreTool
V1/V2 tool restore
Functionality:Restore
Priority:2
Issues for the current backlog.
Milestone
For .NET CLI tools, we want to run the tools on the same version of .NET Core as the tool targets. A tool built for 1.1 should run using the 1.1 shared framework, and a tool built for 2.0 should use the 2.0 shared framework. The tools need to be restored using the same target framework they will run on (otherwise a tool running on 1.1 could end up bringing in 2.0 assets, which would fail).
Currently, the
DotnetCliToolTargetFramework
property can be set to control what target framework is used when restoring tools. However, different tools in the same project may need to be restored for different target frameworks, and furthermore there's no way for the SDK / CLI to know what version of .NET Core the tools target until the package has been downloaded.We (@rrelyea, @emgarten, @livarcocc, and @dsplaisted) met to discuss this and came up with the following design:
DotnetCliToolTargetFramework
will be interpreted by NuGet restore as the maximum target framework that tools can be restored forDotnetCliToolTargetFramework
. (IE if a tools package has folders for netcoreapp1.0, netcoreapp2.0, and netcoreapp3.0, and theDotnetCliToolTargetFramework
is netcoreapp2.1, then it would select netcoreapp2.0.)DotnetCliToolTargetFramework
, the package feeds used, the version of NuGet, etc.).tools\dotnet-mytool\1.0.0-rc\netcoreapp2.0\<hash>
.<BaseIntermediateOutputFolder>\.tools\<toolname>.json
.The text was updated successfully, but these errors were encountered: