Visual Studio 2010 解决方案的 MSBuild 命令行执行无法引用 VS2010 SDK 来构建扩展
包含 VS2010 扩展的场景
- 解决方案(.NET 4 类库,带有 WPF UI)
- 它在 Visual Studio 中构建得很好
- 当我尝试通过命令行构建它时(作为一部分), 在同一台机器上构建脚本)
- 使用此命令尝试构建它时失败:
msbuild JsExt.sln /t:Build /p:Configuration=Debug /p:OutDir=..\..\Binaries
- 更新
- 到
MSBuild
添加/property:VsSDKInstall="C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK"
会导致此结果异常...
- 到
例外
“VSCTCompiler”任务意外失败。 C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ VSSDK \ Microsoft.VsSDK.Common.targets(74,5):错误MSB4018: System.ArgumentNullException:值不能为空。
额外信息
- Visual Studio 2010 SDK SP1 已安装
- 文件
Microsoft.VsSDK.Common.targets
的路径确实存在。 - 我从
x86
控制台和 PowerShell 窗口运行,并且加载了vcvarsall.bat (x86)
- 我不确定
tmp_proj
是什么关于。 - 它是一个 WPF 用户界面,我是否缺少通过 MSBuild 使用 WPF/XAML 编译某些内容的功能?
- 作为扩展名的 CSProj 文件没有任何构建前/构建后事件。
- 构建平台目标是
任何 CPU
- 我有其他解决方案/项目可以使用相同的
MSBuild
命令运行良好。 - 设置
/v:diag
不会提供有关错误的更多信息。
有什么想法,我缺少什么,下一步要调试什么?
Scenario
- Solution that has a VS2010 extension in it (.NET 4 Class library, with a WPF UI)
- It builds fine inside visual studio
- On the same machine when I attempt to build it via command line (as part of a build script)
- Fails when using this command to attempt to build it:
msbuild JsExt.sln /t:Build /p:Configuration=Debug /p:OutDir=..\..\Binaries
- Update
- To
MSBuild
Adding/property:VsSDKInstall="C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK"
leads to this exception...
- To
Exception
The "VSCTCompiler" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.Common.targets(74,5): error MSB4018:
System.ArgumentNullException: Value cannot be null.
Extra info
- Visual Studio 2010 SDK SP1 is installed
- The path to and file
Microsoft.VsSDK.Common.targets
does exist. - I'm running from an
x86
console and PowerShell window andvcvarsall.bat (x86)
are loaded - I'm not sure what the
tmp_proj
is about. - It's a WPF User Interface, is there something I'm missing to compile something with WPF/XAML via MSBuild?
- There is nothing pre/post build events of the CSProj file that is the extension.
- Build platform target is
Any CPU
- I have other solutions/projects working well with the same
MSBuild
command. - Setting
/v:diag
doesn't offer much more information on the errors.
Any ideas, what am I missing, what's next to debug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VSSDKInstall 环境变量是否已设置/显示在控制台中?
如果是这样,请将“/v:diag”添加到您的命令行中,看看会出现什么结果。
看看下面的 博客文章 - 步骤 #3 听起来像是您原来的问题,步骤 #4 解释了您刚刚遇到的后续 VSCTCompiler 问题。
Is the VSSDKInstall env variable set / showing up in your console?
If so, then add "/v:diag" to your cmd line to see what that turns up.
Take a look at the following blog post - step #3 sounds like your original issue, and step #4 explains the subsequent VSCTCompiler issue that you just encountered.