【发布时间】:2015-10-22 10:39:03
【问题描述】:
问题
我有一个包含一些 C++ 项目和 C# 项目的 Windows 运行时解决方案。 Visual Studio 可以很好地构建解决方案。但是,MSBuild 不适用于该解决方案,并且总是以错误 MSB4096 结束。
有没有人知道如何解决它,以便 MSBuild 可以像 Visual Studio 一样构建。
命令
C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /t:Rebuild /p:VisualStudioVersion=12.0;Platform=x86;Configuration=Debug;VCTargetsPath="C:\Program Files (x86 )\MSBuild\Microsoft.Cpp\v4.0\V120";OutDir=C:\Temp1\ /m /verbosity:minimal /nologo C:\Stash\Windows\xxx.sln > C:\Temp1\Log.txt
错误
创建库 ...\OutPut\M.WindowsPhone\M.WindowsPhone.lib 和对象 ...\OutPut\M.WindowsPhone\M.WindowsPhone.exp M.WindowsPhone.vcxproj -> ...\OutPut\M.WindowsPhone\M.WindowsPhone.dll C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(1893,5): error MSB4096: The item "...\SDK\M\M\M.项目列表“ClCompile”中的 Shared......\BlackboardMobile\businessLogic\student\AutoSavingObserver.cpp 未定义元数据“DefiningProjectDirectory”的值。要使用此元数据,请通过指定 %(ClCompile.DefiningProjectDirectory) 对其进行限定,或确保此列表中的所有项目都为此元数据定义一个值。 [...\SDK\M\M\M.WindowsPhone\M.WindowsPhone.vcxproj] 完成构建项目“...\SDK\M\M\M.WindowsPhone\M.WindowsPhone.vcxproj”(重建目标)- 失败。 已完成构建项目“...\Student.sln”(重建目标)——失败。
【问题讨论】:
-
您是否尝试过使用 MSBuild 12.0 (
%C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe) 进行编译?因为这就是 VS 2013 (12.0) 使用的。 -
@Christian.K 酷,它有效。请回复为我接受它的答案。
标签: msbuild