Home > Enterprise >  MSB4018 The "ResolvePackageAssets" task failed unexpectedly
MSB4018 The "ResolvePackageAssets" task failed unexpectedly

Time:12-04

dears, i changing windows user and set it as administrators then i deleted old windows user name after that i can not bulit my MAUI Project in visual studio the error is

Error   MSB4018 The "ResolvePackageAssets" task failed unexpectedly.
NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'C:\Program Files (x86)\ComponentOne\WinForms Edition\bin\v6\'.
   at NuGet.Packaging.FallbackPackagePathResolver..ctor(String userPackageFolder, IEnumerable`1 fallbackPackageFolders)
   at 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 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.<ExecuteInstantiatedTask>d__26.MoveNext()

enter image description here

i try to:

  • create new MAUI Project but the same error
  • changed project folder to anther partition
  • reinstall VS 2022
  • create empty folder C:\Microsoft\Xamarin\Nuget AND C:\Program Files (x86)\ComponentOne\Packages
  • try to reinstall packages by vs command
  • delete bin And obj project folder.
  • but all the same error

CodePudding user response:

I have tried to find a such folder C:\Program Files (x86)\ComponentOne\WinForms Edition\bin\v6\ in my computer. But it doesn't exist.

At first, you can check the two path C:\Program Files (x86)\Microsoft SDKs\NuGetPackages and C:\Program Files (x86)\Microsoft Visual Studio\Shared\, and then copy the the file according to this answer which resolve the same error as yours.

And then you can check the answer which is about setting the visual studio's nuget package's source. You can set the path as C:\Program Files (x86)\Microsoft SDKs\NuGetPackages, this the path in my computer.

In addition, I find the C:\users\xxx\.nugets storage all the nuget packages. And there is a C:\Program Files (x86)\NuGet in my computer.

Finally, a bad but worked solution, you can reinstall or format the windows system, and then install the visual studio.

  • Related