NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Page states that: Nuget Path is Windows: %ProgramFiles(x86)%\NuGet\Config - this is not true in VSC 2022 #13693

Closed MalcolmAnderson closed 2 weeks ago

MalcolmAnderson commented 2 months ago

NuGet Product Used

Other/NA

Product Version

Visual Studio 2022 - default install

Worked before?

No

Impact

I'm unable to use this version

Repro Steps & Context

Please let me know what additional info is needed, I'm not a "VSC expert", and I'm approaching "NuGet beginner"

My current mission is to edit the paths pointing to "Program Files (x86)" because VSC 2022 apparently does not install into the (x86) dir anymore.

On a clean machine (never had ms dev products other than VSCode installed before) install Visual Studio Community 2022. Try to build a solution. Error states: Error (active) MSB4018 The "ResolvePackageAssets" task failed unexpectedly. NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages'.

That is because on my machine, there are no VSC or Nuget directories in Program Files (x86) The nuget package manager options show 2 different files that are being searched for in Program Files (x86) Microsoft.VisualStudio.Offline.config and Microsoft SDKs\NuGetPackages\ vsc_2022_nuget defaults to looking in ProgramFiles (x86)

vsc_2022_nuget defaults to looking in ProgramFiles (x86) - 2

Verbose Logs

No response

MalcolmAnderson commented 2 months ago

Sigh In the last hour (probably during my most recent attempt to rebuild the project), both "Microsoft Visual Studio" and "NuGet" folders were added to my "Program Files (x86) directory. I guess you can close this, but it feels like there is a disconnect between the VSC team and the NuGet team. I've been fighting with getting the project to build for 4 or 5 hours over the last 24.

MalcolmAnderson commented 2 months ago

Again, VSC 2024 installed with all files in the "Program Files" dir, but NuGet was pointing at the "Program Files (x86) dir. Here was the error I was receiving

Severity Code Description Project File Line Suppression State Error (active) MSB4018 The "ResolvePackageAssets" task failed unexpectedly. NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages'. at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable1 fallbackPackageFolders) at [Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(IEnumerable](http://microsoft.net.build.tasks.nugetpackageresolver.createresolver(ienumerable/)1 packageFolders) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task) at [Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets](http://microsoft.net.build.tasks.resolvepackageassets.cachereader.createreaderfromdisk(resolvepackageassets/) task, Byte[] settingsHash) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task) at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups() at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore() at Microsoft.NET.Build.Tasks.TaskBase.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() Sample C:\Program Files\dotnet\sdk\8.0.303\Sdks[Microsoft.NET.Sdk](http://microsoft.net.sdk/)\targets\Microsoft.PackageDependencyResolution.targets 266

donnie-msft commented 1 month ago

VSCode & VS are different products. Visual Studio (VS) will create the Program Files (x86) directory and put a nuget.config there. VS Code doesn't do this to my knowledge.

It sounds like the issue is resolved now. Please let us know if you experience it again!

microsoft-github-policy-service[bot] commented 1 month ago

This issue has been automatically marked as stale because we have not received a response in 14 days. It will be closed if no further activity occurs within another 14 days of this comment.