无法在 Visual Studio 2013 中加载任何 MSBuild 项目
Cannot load any MSBuild project in Visual Studio 2013
我刚开始学习 MSBuild 并尝试将下面的简单测试项目加载到 Visual Studio 2013(更新 5),但出现错误 'The project system has encountered an error' - 'The given key was not present in the dictionary.'
注意我可以从命令行使用 MSBuild 成功构建项目,只是想在 VS 项目树中看到它作为其他解决方案的一部分 csproj/vcxproj/etc。项目。
我尝试了几种方法,更改 msbuildproj 文件中的点点滴滴,等等 - 没有成功,总是出现同样的错误。知道我做错了什么吗? MSBuild 项目不应该添加到 VS 解决方案吗?
<!-- mytest.msbuildproj -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<Target Name="Build">
<Message Text="Building my target" />
</Target>
</Project>
The project system has encountered an error
VsProjectFault_8c79b7c1-086a-47e9-be8c-46300a431de3.failure.txt:
=====================
01/03/2016 17:10:25
Recoverable
System.AggregateException: One or more errors occurred. ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at Microsoft.Collections.Immutable.ImmutableDictionary2.get_Item(TKey key)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GetProjectRootProperties(ConfiguredProjectExports configuredProjectExports)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GenerateOriginalTree(ConfiguredProjectExports configuredProjectExports, CancellationToken cancellationToken)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.<GenerateOriginalTreeAsync>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.VisualStudio.ProjectSystem.Utilities.Designers.ProjectTreeProviderBase.<>c__DisplayClass9.<<Initialize>b__5>d__b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.Utilities.CommonProjectSystemTools.Rethrow(Exception ex)
at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass5.<SubmitErrorReport>b__3()
at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2.<Guard>b__0()
at GuardMethodClass.GuardMethod(Func
1 , Func2 , Func
2 )
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at Microsoft.Collections.Immutable.ImmutableDictionary2.get_Item(TKey key)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GetProjectRootProperties(ConfiguredProjectExports configuredProjectExports)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GenerateOriginalTree(ConfiguredProjectExports configuredProjectExports, CancellationToken cancellationToken)
at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.<GenerateOriginalTreeAsync>d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.VisualStudio.ProjectSystem.Utilities.Designers.ProjectTreeProviderBase.<>c__DisplayClass9.<<Initialize>b__5>d__b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.ProjectSystem.Utilities.CommonProjectSystemTools.Rethrow(Exception ex)
at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass5.<SubmitErrorReport>b__3()
at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2.<Guard>b__0()
at GuardMethodClass.GuardMethod(Func
1 , Func2 , Func
2 )<---
===================
并非所有的 msbuild 文件都是一样的。当然你可以从头开始制作一个,然后 运行 在命令行上。但这并不意味着 visual studio 会喜欢该文件。
Visual studio 需要一个具有特定架构的 msbuild 文件,而上述文件不符合要求。
我刚开始学习 MSBuild 并尝试将下面的简单测试项目加载到 Visual Studio 2013(更新 5),但出现错误 'The project system has encountered an error' - 'The given key was not present in the dictionary.'
注意我可以从命令行使用 MSBuild 成功构建项目,只是想在 VS 项目树中看到它作为其他解决方案的一部分 csproj/vcxproj/etc。项目。
我尝试了几种方法,更改 msbuildproj 文件中的点点滴滴,等等 - 没有成功,总是出现同样的错误。知道我做错了什么吗? MSBuild 项目不应该添加到 VS 解决方案吗?
<!-- mytest.msbuildproj -->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<Target Name="Build">
<Message Text="Building my target" />
</Target>
</Project>
The project system has encountered an error
VsProjectFault_8c79b7c1-086a-47e9-be8c-46300a431de3.failure.txt:
===================== 01/03/2016 17:10:25 Recoverable System.AggregateException: One or more errors occurred. ---> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at Microsoft.Collections.Immutable.ImmutableDictionary
2.get_Item(TKey key) at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GetProjectRootProperties(ConfiguredProjectExports configuredProjectExports) at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GenerateOriginalTree(ConfiguredProjectExports configuredProjectExports, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.<GenerateOriginalTreeAsync>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.VisualStudio.ProjectSystem.Utilities.Designers.ProjectTreeProviderBase.<>c__DisplayClass9.<<Initialize>b__5>d__b.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.ProjectSystem.Utilities.CommonProjectSystemTools.Rethrow(Exception ex) at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass5.<SubmitErrorReport>b__3() at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2.<Guard>b__0() at GuardMethodClass.GuardMethod(Func
1 , Func2 , Func
2 ) --- End of inner exception stack trace --- ---> (Inner Exception #0) System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. at Microsoft.Collections.Immutable.ImmutableDictionary2.get_Item(TKey key) at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GetProjectRootProperties(ConfiguredProjectExports configuredProjectExports) at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.GenerateOriginalTree(ConfiguredProjectExports configuredProjectExports, CancellationToken cancellationToken) at Microsoft.VisualStudio.ProjectSystem.Designers.PhysicalProjectTreeProvider.<GenerateOriginalTreeAsync>d__35.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.VisualStudio.ProjectSystem.Utilities.Designers.ProjectTreeProviderBase.<>c__DisplayClass9.<<Initialize>b__5>d__b.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.ProjectSystem.Utilities.CommonProjectSystemTools.Rethrow(Exception ex) at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass5.<SubmitErrorReport>b__3() at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2.<Guard>b__0() at GuardMethodClass.GuardMethod(Func
1 , Func2 , Func
2 )<---
===================
并非所有的 msbuild 文件都是一样的。当然你可以从头开始制作一个,然后 运行 在命令行上。但这并不意味着 visual studio 会喜欢该文件。
Visual studio 需要一个具有特定架构的 msbuild 文件,而上述文件不符合要求。