无法在Visual Studio 2013中加载任何MSBuild项目

时间:2016-03-02 12:11:07

标签: visual-studio-2013 msbuild

我刚开始学习MSBuild,并尝试将以下简单的测试项目加载到Visual Studio 2013(更新5),但我收到错误'项目系统遇到错误& #39; - '字典中没有给定的密钥。'

注意我可以从命令行使用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:

  

=====================   2016/03/01 17:10:25   可采   System.AggregateException:发生一个或多个错误。 ---&GT; System.Collections.Generic.KeyNotFoundException:给定的键不在字典中。      在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,Func 2 , Func 2)      ---内部异常堆栈跟踪结束---   ---&GT; (内部异常#0)System.Collections.Generic.KeyNotFoundException:给定的键不在字典中。      在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,Func 2 , Func 2)&lt; ---

===================

1 个答案:

答案 0 :(得分:0)

并非所有msbuild文件都是相同的。当然,您可以从头开始制作一个,并在命令行上运行它。但这并不意味着视觉工作室会喜欢那个文件。

Visual Studio需要一个具有特定架构的msbuild文件,而上述文件并不适合该账单。