Unable to find fallback package folder
Steps to reproduce
- Start with a clean Windows box and install Visual Studio Enterprise 2017 (latest) with .NET Core.
- Clone https://github.com/azure/azure-iot-sdk-csharp and run
jenkins\windows_csharp.cmdin root.
Expected behavior
Builds works as expected.
Actual behavior
BUILD: --- SecurityProvider for TPM Debug ---
Microsoft (R) Build Engine version 15.6.82.30579 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: The "ResolvePackageDependencies" task failed unexpectedly. [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Users\cipop\.dotnet\NuGetFallbackFolder'. [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders) [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(LockFile lockFile, String projectPath) [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.get_PackageResolver() [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.ResolvePackagePath(LockFileLibrary package) [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.NET.Build.Tasks.ResolvePackageDependencies.GetPackageAndFileDefinitions() [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.NET.Build.Tasks.TaskBase.Execute() [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() in E:\A\_work\82\s\src\Build\BackEnd\TaskExecutionHost\TaskExecutionHost.cs:line 631 [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
C:\Program Files\dotnet\sdk\2.1.101\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__25.MoveNext() in E:\A\_work\82\s\src\Build\BackEnd\Components\RequestBuilder\TaskBuilder.cs:line 787 [S:\cs\security\tpm\src\Microsoft.Azure.Devices.Provisioning.Security.Tpm.csproj]
Environment data
dotnet --info output:
dotnet --info
.NET Command Line Tools (2.1.101)
Product Information:
Version: 2.1.101
Commit SHA-1 hash: 6c22303bf0
Runtime Environment:
OS Name: Windows
OS Version: 10.0.16299
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.101\
Microsoft .NET Core Shared Framework Host
Version : 2.0.6
Build : 74b1c703813c8910df5b96f304b0f2b78cdf194d
There is something interesting in the Users folder:
USERNAME=cipop
USERPROFILE=C:\Users\cipop.CORP
> dir c:\Users\ /b
Administrator
cipop
cipop.CORP
Public
Seems to be related to dotnet/sdk#8578, dotnet/sdk#8536, dotnet/sdk#8578, dotnet/sdk#8680 .
Workaround:
mkdir C:\Users\cipop\.dotnet\NuGetFallbackFolder
I just tried building the repo you mentioned above and the build succeeded, though with test failures.
Can you check your Nuget.Config files and check that you don't have an entry pointing to that folder anywhere?
We had the CLI using that folder a long time ago, before we even released a 2.0 CLI but we have long since moved away from using or setting that folder.
Can you check your Nuget.Config files and check that you don't have an entry pointing to that folder anywhere?
This is a fresh machine on which I've only installed Visual Studio 2017 Enterprise. What Nuget.Config should I check?
Check %appdata%/nuget/nuget.config.
Also @rohit21agrawal @nkolev92 is there a way to add diagnostics to see which nuget.config are being used by restore?
Increase the verbosity level. Restore prints that at the end of each run.
Try
/v:d
%appdata%/nuget/nuget.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
@CIPop Can you do the following:
dotnet msbuild /t:GenerateRestoreGraphFile /p:RestoreGraphOutputPath=a.dg
and attach that a.dg file here?
Note that it will have your full dependency graph.
You can also look there for references of that folder.
dotnet msbuild /t:GenerateRestoreGraphFile /bl
and attaching the binlog would do the same trick as well.
I did:
S:\cs (master -> origin)
λ nuget locals all -clear
Local resources cleared.
S:\cs (master -> origin)
λ git clean -xdf
λ build -verb d
I can't repro anymore even if I remove the workaround...
Graph file: a.dg.txt
@nkolev92 This isn't the first time I see this on a fresh Windows deployment. Somehow it went away after creating that folder and it doesn't seem to crash even if I deleted the workaround.
Closing for now - I can reopen when I rebuild my dev box again or I see this on a VM.
Sounds good @CIPop
For reference, the dg spec file, has the evaluated FallbackFolders and the config file paths.
That's normally extremely helpful when investigating restore related issues.
I have the same error, but on Windows Subsystem Linux, Bash on Ubuntu on Windows
/usr/local/dotnet/sdk/2.1.101/Sdks/Microsoft.NET.Sdk/build/Microsoft.PackageDependencyResolution.targets(172,5): error MSB4018: NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Program Files\dotnet\sdk\NuGetFallbackFolder'. [/mnt/d/code/bb-aiv/municipality-registry/src/MunicipalityRegistry.Api.Oslo/MunicipalityRegistry.Api.Oslo.csproj]
Which makes sense, since there is no C:\ either it is ~/.dotnet or /mnt/c/
@CumpsD NuGet does not generate the fallback folder path, it's passed to it through a property.
I'd suggest opening an issue on CLI side.
To confirm that this is the case, you can generate the /v:d logs and upload them here for us to double check, or just look for the RestoreFallbackFolders property and it's value.
@CumpsD I would treat this as a different issue from this one. If this is consistently happening to you, please file a separate issue with repro steps and we can take a look.
@nkolev92 this is already the CLI repo 😄
I've "fixed" it by not relying on the fallback folder:
<PropertyGroup>
<RestoreFallbackFolders>clear</RestoreFallbackFolders>
</PropertyGroup>
KirillOsenkov in your case, the folder is being used as a NuGet source, it is just called Fallback folder. Note that the property being set is NuGetPackageFolders. I don't believe your issue has anything to do with this one.
We're talking on slack, but re-closing since I agree this is different. If there's an issue in CLI after chatting, we'll reopen a different one.
I "fixed" it via remove dotnet clean before dotnet restore in my Dockerfile
If you are using Docker and getting this error, make sure you have a .dockerignore and do not copy over the bin and obj files.
**/bin
**/obj
**/out
**/.vscode
**/.vs
.dotnet
.Microsoft.DotNet.ImageBuilder
VIA: https://github.com/dotnet/dotnet-docker/blob/master/.dockerignore