I use Visual Studio 2022, and my Hard Drive D:\ stopped, so I had to reinstall and edit in regedit Computador\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\Setup\SharedInstallationPath from D:\ to C:\ and Now I'm with MSB4018 error

Luiz Carlos 1 Reputation point

Gravidade Código Descrição Projeto Arquivo Linha Estado de Supressão
Erro MSB4018 Falha inesperada da tarefa "ResolvePackageAssets".
NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'D:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages'.
em NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable1 fallbackPackageFolders) em Microsoft.NET.Build.Tasks.NuGetPackageResolver.CreateResolver(IEnumerable1 packageFolders)
em Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task)
em Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromDisk(ResolvePackageAssets task, Byte[] settingsHash)
em Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task)
em Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups()
em Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore()
em Microsoft.NET.Build.Tasks.TaskBase.Execute()
em Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
em Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() Programar Hibernação C:\Program Files\dotnet\sdk\6.0.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 267

Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
990 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 50,426 Reputation points

    Simply changing a registry entry isn't going to get VS working again. VS used to store everything in the registry but since at least VS 2017 they moved to storing a lot in files on the file system to help support multiple instances and removing the clutter in the registry.

    At a minimum, besides all the registry entries (there would be shared entries + the instance specific ones and they are both in HKLM and HKCU. You would also need to find and update all the file system files that are impacted. For example all the package management tools store stuff in your AppData directories.

    I'm not sure how you "reinstalled" VS but I don't see any way of recovering short of actually putting a new D: drive on and then running the VS repair. If you don't want a new D: then after you've repaired the installation then uninstall all of VS and reinstall to the C: drive.

    The specific error you're getting looks like a Nuget caching issue to me. Nuget isn't finding a package when it restores and it is walking through the file system locations that it would normally store packages to see if it can find it before it tries to download again.

  2. Tianyu Sun-MSFT 28,846 Reputation points Microsoft Vendor

    Hi @Luiz Carlos ,

    Normally, the path of fallback package folder is set in Microsoft.VisualStudio.FallbackLocation.config file in C:\Program Files (x86)\NuGet\Config.

    Please check if this file exists in your C drive and if it exists, try to open it and edit the path to the correct one(in case it was set to D:\...), then restart VS.

        <add key="Microsoft Visual Studio Fallback Folder" value="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" />  

    Best Regards,

    • If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
      Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
    0 comments No comments