CLI project tools are not resolved if .tools folder is not in the same cache as the package
See original GitHub issueWith the NuGet FallbackPackageFolders feature, it is possible to have the packages in a fallbackPackageFolder
and restoring a project causes the .tools
folder to be created in the %Userprofile%\.nuget\
directory.
In this case, CLI fails to resolve the project tool.
PM> dotnet -d aspnet-codegenerator
Telemetry is: Enabled
projectfactory: MSBUILD_EXE_PATH = C:\Program Files\dotnet\sdk\1.0.0-rc4-004755\MSBuild.dll
projectfactory: MSBuild project path = C:\users\fwtlabb\documents\visual studio 2017\Projects\WebApplication1\WebApplication1\WebApplication1.csproj
projecttoolscommandresolver: resolving commandspec from 3 Tool Libraries.
projecttoolscommandresolver: Attempting to resolve command spec from tool Microsoft.EntityFrameworkCore.Tools.DotNet
projecttoolscommandresolver: nuget packages root:
- C:\Users\fwtlabb\.nuget\packages\
- C:\Program Files\Microsoft SDKs\NuGetFallbackPackages\
projecttoolscommandresolver: found tool lockfile at : C:\Users\fwtlabb\.nuget\packages\.tools\microsoft.entityframeworkcore.tools.dotnet\1.0.0-msbuild3-final\netcoreapp1.0\project.assets.js
on
projecttoolscommandresolver: expect deps.json at: C:\Users\fwtlabb\.nuget\packages\.tools\microsoft.entityframeworkcore.tools.dotnet\1.0.0-msbuild3-final\netcoreapp1.0\Microsoft.EntityFrame
workCore.Tools.DotNet.deps.json
projecttoolscommandresolver: attempting to create commandspec
packagedcommandspecfactory: attempting to find command dotnet-aspnet-codegenerator in Microsoft.EntityFrameworkCore.Tools.DotNet
packagedcommandspecfactory: failed to find toolAssembly for dotnet-aspnet-codegenerator
projecttoolscommandresolver: commandSpec is null.
projecttoolscommandresolver: Attempting to resolve command spec from tool Microsoft.Extensions.SecretManager.Tools
projecttoolscommandresolver: nuget packages root:
- C:\Users\fwtlabb\.nuget\packages\
- C:\Program Files\Microsoft SDKs\NuGetFallbackPackages\
projecttoolscommandresolver: found tool lockfile at : C:\Users\fwtlabb\.nuget\packages\.tools\microsoft.extensions.secretmanager.tools\1.0.0-msbuild3-final\netcoreapp1.0\project.assets.json
projecttoolscommandresolver: expect deps.json at: C:\Users\fwtlabb\.nuget\packages\.tools\microsoft.extensions.secretmanager.tools\1.0.0-msbuild3-final\netcoreapp1.0\Microsoft.Extensions.Se
cretManager.Tools.deps.json
projecttoolscommandresolver: attempting to create commandspec
packagedcommandspecfactory: attempting to find command dotnet-aspnet-codegenerator in Microsoft.Extensions.SecretManager.Tools
packagedcommandspecfactory: failed to find toolAssembly for dotnet-aspnet-codegenerator
projecttoolscommandresolver: commandSpec is null.
projecttoolscommandresolver: Attempting to resolve command spec from tool Microsoft.VisualStudio.Web.CodeGeneration.Tools
projecttoolscommandresolver: nuget packages root:
- C:\Users\fwtlabb\.nuget\packages\
- C:\Program Files\Microsoft SDKs\NuGetFallbackPackages\
projecttoolscommandresolver: found tool lockfile at : C:\Users\fwtlabb\.nuget\packages\.tools\microsoft.visualstudio.web.codegeneration.tools\1.0.0-msbuild3-final\netcoreapp1.0\project.asse
ts.json
projecttoolscommandresolver: expect deps.json at: C:\Users\fwtlabb\.nuget\packages\.tools\microsoft.visualstudio.web.codegeneration.tools\1.0.0-msbuild3-final\netcoreapp1.0\Microsoft.Visual
Studio.Web.CodeGeneration.Tools.deps.json
projecttoolscommandresolver: attempting to create commandspec
packagedcommandspecfactory: attempting to find command dotnet-aspnet-codegenerator in Microsoft.VisualStudio.Web.CodeGeneration.Tools
packagedcommandspecfactory: failed to find commandPath C:\Users\fwtlabb\.nuget\packages\microsoft.visualstudio.web.codegeneration.tools\1.0.0-msbuild3-final\lib\netcoreapp1.0\dotnet-aspnet-
codegenerator.dll
projecttoolscommandresolver: commandSpec is null.
projecttoolscommandresolver: failed to resolve commandspec from library.
dotnet --info
output:
.NET Command Line Tools (1.0.0-rc4-004755)
Product Information:
Version: 1.0.0-rc4-004755
Commit SHA-1 hash: bffbee2b91
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10240
OS Platform: Windows
RID: win10-x86
Base Path: C:\Program Files\dotnet\sdk\1.0.0-rc4-004755
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:11 (10 by maintainers)
Top Results From Across the Web
CLI project tools are not resolved if .tools folder is not in the ...
As a workaround could ASP remove the tool packages from the fallback folders and add them to a source instead? This would mean...
Read more >Cannot use MSBuild API from a dotnet-CLI project tool #1097
Using MSBuild API for in-proj project evaluation in a dotnet-CLI project tool throws this excpetion: Unhandled Exception: System.
Read more >Android studio- "SDK tools directory is missing"
Once the installation is complete, just check whether "tools" folder is there or not (At the location where you are installing the SDK)....
Read more >.NET Core 3 Local Tools
A look at the .NET Core Local Tools introduced in 3.0, contrasting the new way with the old way of dealing with locally...
Read more >dotnet tool restore command - .NET CLI
The dotnet tool restore command installs on your machine the .NET local tools that are in scope for the current directory.
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 Free
Top 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
We need to use this to properly fix this problem. https://github.com/NuGet/NuGet.Client/blob/4cccb13833ad29d6a0bcff055460d964f1b49cfe/src/NuGet.Core/NuGet.Packaging/FallbackPackagePathResolver.cs
As a workaround could ASP remove the tool packages from the fallback folders and add them to a source instead? This would mean that just the tool packages are copied and extracted to the global folder. Would the tool runner work in that scenario?