Visual Studio 2022项目在升级到17.5.4后无法加载。

huangapple go评论74阅读模式
英文:

Visual Studio 2022 projects failing to load after update to 17.5.4

问题

我最近更新了Visual Studio 2022到17.5.4版本,从17.4.5版本。升级后所有项目加载失败。我尝试修复安装,也卸载并重新安装了最新版本以及先前版本,但仍没有运气。感谢任何帮助。

错误:SDK解析器失败:"Microsoft.DotNet.MSBuildSdkResolver"在尝试解析SDK "Microsoft.NET.Sdk"时失败。异常:"System.FormatException: 无效的数值标识符:'300_bak'。

英文:

I recently updated visual studio 2022 to version 17.5.4 from 17.4.5. after doing so all project fail to load. I have tried repairing the install, I have also uninstalled and reinstalled the newest version as well as the previous version, still no luck. Any help is appreciated.

error  : SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildSdkResolver" failed while attempting to resolve the SDK "Microsoft.NET.Sdk". Exception: "System.FormatException: Invalid numeric identifier: '300_bak'.
   at Microsoft.Deployment.DotNet.Releases.ReleaseVersion.TryParseCoreVersionPart(String input, Boolean throwOnFailure, Int32& value)
   at Microsoft.Deployment.DotNet.Releases.ReleaseVersion.TryParse(String input, Boolean throwOnFailure, ReleaseVersion& version)
   at Microsoft.Deployment.DotNet.Releases.ReleaseVersion.Parse(String input)
   at Microsoft.Deployment.DotNet.Releases.ReleaseVersion..ctor(String version)
   at Microsoft.NET.Sdk.WorkloadManifestReader.SdkFeatureBand..ctor(String version)
   at Microsoft.NET.Sdk.WorkloadManifestReader.SdkDirectoryWorkloadManifestProvider.<>c.<FallbackForMissingManifest>b__9_1(String featureBand)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
   at System.Linq.Enumerable.Max[TSource](IEnumerable`1 source)
   at Microsoft.NET.Sdk.WorkloadManifestReader.SdkDirectoryWorkloadManifestProvider.FallbackForMissingManifest(String manifestId)
   at Microsoft.NET.Sdk.WorkloadManifestReader.SdkDirectoryWorkloadManifestProvider.GetManifestDirectories()
   at Microsoft.NET.Sdk.WorkloadManifestReader.SdkDirectoryWorkloadManifestProvider.<GetManifests>d__7.MoveNext()
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.LoadManifestsFromProvider(IWorkloadManifestProvider manifestProvider)
   at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.Create(IWorkloadManifestProvider manifestProvider, String dotnetRootPath, String sdkVersion, String userProfileDir)
   at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.CachingWorkloadResolver.Resolve(String sdkReferenceName, String dotnetRootPath, String sdkVersion, String userProfileDir)
   at Microsoft.DotNet.MSBuildSdkResolver.DotNetMSBuildSdkResolver.Resolve(SdkReference sdkReference, SdkResolverContext context, SdkResultFactory factory)
   at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.TryResolveSdkUsingSpecifiedResolvers(IList`1 resolvers, Int32 submissionId, SdkReference sdk, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStudio, SdkResult& sdkResult)

答案1

得分: 1

I uninstalled Visual Studio 17.5.4, installed version 17.2.10 from here (https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history), verified that everything worked as before, project was now able to be created and loaded, unfortunately some of the templates I needed (i.e. MAUI) were not installed, so I updated to version 17.2.15, that did not install the MAUI templates, but visual studio was still able to load projects. I tried installing visual studio 17.5.4 (side by side) and it still will not load projects. I launched version 17.2.15 and projects load fine. Uninstalled version 17.5.4, then reinstalled version 17.4.4, the world is right again. I am coming to the conclusion that there is something wrong with visual studio on my laptop for version 17.5.4.

英文:

I uninstalled Visual Studio 17.5.4, installed version 17.2.10 from here (https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history), verified that everything worked as before, project was now able to be created and loaded, unfortunately some of the templates I needed (i.e. MAUI) were not installed, so I updated to version 17.2.15, that did not install the MAUI templates, but visual studio was still able to load projects. I tried installing visual studio 17.5.4 (side by side) and it still will not load projects. I launched version 17.2.15 and projects load fine. Uninstalled version 17.5.4, then reinstalled version 17.4.4, the world is right again. I am coming to the conclusion that there is something wrong with visual studio on my laptop for version 17.5.4

答案2

得分: 1

I've had the same issue with every update I install. I am also working in MAUI so I have been jumping on the updates. For me it is always an environment variables issue and throws the SDK error. Every update switches my dotnet paths and that is what has been causing the projects to fail to load in my solutions.

TLDR: 前往环境变量,查看System Variables中的PATH(不要与User Variables混淆)。 C:\Program Files\dotnet\ 需要在 C:\Program Files (x86)\dotnet\ 之前。

对于初次尝试查找环境变量的人,可以参考这个指南来找到PATH

一旦在那里,将 C:\Program Files\dotnet\ 移动到位于 C:\Program Files (x86)\dotnet\ 之上。

有关x86问题的更多信息,请参阅此处

英文:

I've had the same issue with every update I install. I am also working in MAUI so I have been jumping on the updates. For me it is always an environment variables issue and throws the SDK error. Every update switches my dotnet paths and that is what has been causing the projects to fail to load in my solutions.

TLDR: Go to your environment variables and take a look at PATH in System Variables (not to be confused with User Variables). C:\Program Files\dotnet\ needs to be before C:\Program Files (x86)\dotnet\.

For anyone new to digging around your environment variables here is this guide to get you to PATH.

Once you're there find C:\Program Files\dotnet\ and move it up until it is over C:\Program Files (x86)\dotnet\.

Further reading about the x86 issue here

huangapple
  • 本文由 发表于 2023年4月20日 04:36:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76058628.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定