无法在 Visual Studio for Mac 中构建 NET 8 解决方案

问题描述 投票:0回答:1

我收到了引用 NET 8 的 Visual Studio 解决方案,我正在尝试在 Visual Studio for Mac 上打开它。

我已从 MS 网站安装了 NET 8,并在 Visual Studio 中启用了“使用 .NET 8 SDK(如果已安装)”设置。但是,当我尝试构建解决方案时,我收到此错误。关于如何解决这个问题以便我可以构建它有什么想法吗?我已经安装了最新版本的 System.CodeDom nuget 但这并不能解决问题。

错误:

/usr/local/share/dotnet/sdk/8.0.403/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.GenerateAssemblyInfo.targets(5,5): Error MSB4018: The "WriteCodeFragment" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'System.CodeDom, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)
File name: 'System.CodeDom, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
 ---> System.IO.FileLoadException: Could not load file or assembly 'System.CodeDom, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Microsoft.Build.Locator.MSBuildLocator.<>c__DisplayClass15_0.<RegisterMSBuildPath>g__TryLoadAssembly|3(AssemblyName assemblyName)
   at Microsoft.Build.Locator.MSBuildLocator.<>c__DisplayClass15_0.<RegisterMSBuildPath>b__2(AssemblyLoadContext _, AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.GetFirstResolvedAssemblyFromResolvingEvent(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
   at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
   at Microsoft.Build.Tasks.WriteCodeFragment.GenerateCode(String& extension)
   at Microsoft.Build.Tasks.WriteCodeFragment.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) (MSB4018) (ClearBank.DeveloperTest)
.net-8.0 visual-studio-mac
1个回答
0
投票

Visual Studio for Mac 在 .NET 8 发布之前已停产,并且从未更新以添加支持。该产品不再受支持,包括安全更新,因此您应该强烈考虑迁移到其他环境。 MS官方推荐的是VS Code,但是很多Mac用户也使用Rider。

© www.soinside.com 2019 - 2024. All rights reserved.