加载 VS 项目失败并出现 InvalidProjectDataException

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

我在 VS 2022 Enterprise 中加载示例项目时遇到问题 我缺少目标 Path 属性(为空),但找不到设置它的位置。

由于项目未加载,我想我需要将其手动设置为 .sln 或 .csproj 文件中的文本路径?

错误信息是:

Microsoft.VisualStudio.LanguageServices.ProjectSystem.InvalidProjectDataException:属性“TargetPath”必须是绝对路径,但值为“”。

Microsoft.VisualStudio.LanguageServices.ProjectSystem.InvalidProjectDataException: Property 'TargetPath' is required to be an absolute path, but the value is ''.
   at Microsoft.VisualStudio.LanguageServices.ProjectSystem.EvaluationData.GetRequiredPropertyAbsolutePathValue(String name)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.CPS.CPSProjectFactory.<CreateProjectContextAsync>d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.LanguageServices.Workspace.<>c__DisplayClass39_0.<<OnEvaluationUpdateAsync>g__ProcessInitialEvaluationDataAsync|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>g__Action|0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
path properties visual-studio-2022 target
1个回答
0
投票

我遇到了类似的问题,并通过关闭 VS 2022,然后删除解决方案根文件夹中的

.vs
文件夹,然后再次打开解决方案来修复它。希望这有帮助。

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