MSB4018 解决包资产任务意外失败,同时尝试学习如何在 C# 中使用堆栈
MSB4018 Resolve Package Assets task failed unexpectedly, while trying to learn how to use stacks in c#
您好,感谢您的提前帮助
上面的错误代码是在尝试学习堆栈时出现的。
我在 windows 11,我在网上看到的大多数其他问题都使用 macs,并指出 mac 版本的问题,据我所知他们不能在这里帮助我。
到目前为止我已经尝试过:
正在两个不同的驱动器上重新安装Visual Studio,一个 SSD 和另一个 HDD
正在删除 obj 和 bin 等文件夹
正在通过安装程序修复visual studio
{
Stack stack = new Stack();
stack.Push('g');
stack.Push('n');
stack.Push('i');
stack.Push('t');
stack.Push('e');
stack.Push('e');
stack.Push('r');
stack.Push('g');
Console.WriteLine("Item have been added to the stack");
DisplayStack(stack);
Console.ReadKey();
}
static void DisplayStack(Stack stack)
{
foreach (char item in stack)
{
Console.WriteLine("The Stack Content is: {0}", item);
}
}
以及非常长的完整错误消息:
Severity Code Description Project File Line Suppression State
Error MSB4018 The "ResolvePackageAssets" task failed unexpectedly.
NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'D:\Coding\Components-tools-SDK\NuGetPackages'.
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.NuGetPackageResolver.CreateResolver(LockFile lockFile)
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() pushpopstacks C:\Program Files\dotnet\sdk.0.406\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 241
再次感谢任何帮助或建议。
您好,感谢您的提前帮助
上面的错误代码是在尝试学习堆栈时出现的。 我在 windows 11,我在网上看到的大多数其他问题都使用 macs,并指出 mac 版本的问题,据我所知他们不能在这里帮助我。
到目前为止我已经尝试过:
正在两个不同的驱动器上重新安装Visual Studio,一个 SSD 和另一个 HDD
正在删除 obj 和 bin 等文件夹
正在通过安装程序修复visual studio
{ Stack stack = new Stack(); stack.Push('g'); stack.Push('n'); stack.Push('i'); stack.Push('t'); stack.Push('e'); stack.Push('e'); stack.Push('r'); stack.Push('g'); Console.WriteLine("Item have been added to the stack"); DisplayStack(stack); Console.ReadKey(); } static void DisplayStack(Stack stack) { foreach (char item in stack) { Console.WriteLine("The Stack Content is: {0}", item); } }
以及非常长的完整错误消息:
Severity Code Description Project File Line Suppression State
Error MSB4018 The "ResolvePackageAssets" task failed unexpectedly.
NuGet.Packaging.Core.PackagingException: Unable to find fallback package folder 'D:\Coding\Components-tools-SDK\NuGetPackages'.
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.NuGetPackageResolver.CreateResolver(LockFile lockFile)
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() pushpopstacks C:\Program Files\dotnet\sdk.0.406\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 241
再次感谢任何帮助或建议。