sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Unable to find fallback package folder

Open CIPop opened this issue 8 years ago • 46 comments

Steps to reproduce

  1. Start with a clean Windows box and install Visual Studio Enterprise 2017 (latest) with .NET Core.
  2. Clone https://github.com/azure/azure-iot-sdk-csharp and run jenkins\windows_csharp.cmd in 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 .

CIPop avatar Mar 15 '18 21:03 CIPop

Workaround:

mkdir C:\Users\cipop\.dotnet\NuGetFallbackFolder

CIPop avatar Mar 15 '18 21:03 CIPop

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.

livarcocc avatar Mar 15 '18 21:03 livarcocc

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?

CIPop avatar Mar 16 '18 19:03 CIPop

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?

livarcocc avatar Mar 16 '18 20:03 livarcocc

Increase the verbosity level. Restore prints that at the end of each run.

Try

/v:d

nkolev92 avatar Mar 16 '18 20:03 nkolev92

%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 avatar Mar 16 '18 23:03 CIPop

@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.

nkolev92 avatar Mar 16 '18 23:03 nkolev92

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

CIPop avatar Mar 16 '18 23:03 CIPop

Graph file: a.dg.txt

CIPop avatar Mar 16 '18 23:03 CIPop

@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.

CIPop avatar Mar 16 '18 23:03 CIPop

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.

nkolev92 avatar Mar 16 '18 23:03 nkolev92

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 avatar Apr 17 '18 15:04 CumpsD

@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.

nkolev92 avatar Apr 17 '18 18:04 nkolev92

@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 😄

livarcocc avatar Apr 17 '18 18:04 livarcocc

I've "fixed" it by not relying on the fallback folder:

  <PropertyGroup>
    <RestoreFallbackFolders>clear</RestoreFallbackFolders>
  </PropertyGroup>

CumpsD avatar Apr 18 '18 09:04 CumpsD

I'm seeing this issue now. binlog.zip

@livarcocc can you glean anything from the attached .binlog?

KirillOsenkov avatar Jun 08 '18 18:06 KirillOsenkov

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.

livarcocc avatar Jun 08 '18 19:06 livarcocc

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.

nguerrera avatar Jun 08 '18 19:06 nguerrera

I "fixed" it via remove dotnet clean before dotnet restore in my Dockerfile

framebassman avatar Jul 31 '19 12:07 framebassman

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

VictorioBerra avatar Feb 05 '20 17:02 VictorioBerra