我很難搞清楚要填充到我創建的xml文件中的字段。我一直試圖按照'使用MSBuild創建一個Visual C++項目'(http://msdn.microsoft.com/en-us/library/dd293607.aspx),但我被困在xml部分。 所以字段有:通過命令提示符編譯C++項目
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.default.props" />
<PropertyGroup>
<ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v120</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="main.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Targets" />
</Project>
我知道我必須要改變的唯一部分是項目組部分符合我所有的.cpp和.h文件。所有的領域都是必要的嗎?您可以舉出每個導入項目中的$(VCTargetsPath)示例嗎?這似乎很簡單,但只是在第一次做完之後。謝謝。
我想用該目錄填寫所有的VCTargetsPaths?有沒有簡單的方法來使用visual studio項目在命令提示符下創建腳本? – dspaces1
我發現了一個更簡單的方法來傳入參數。在Visual Studios中,我去了DEBUG->「project」Properties - > Configuration Properties - > Debugging - > Command Arguments並填入我的輸入。 – dspaces1
@ dspaces1,當您安裝Microsoft Windows SDK(或Visual Studio,其中包括Microsoft Windows SDK)時,將設置屬性VCTargetsPath的值。它看起來像你沒有安裝SDK,或者你可能手動將SDK文件複製到機器上,或者安裝被破壞了。我將從修正正確的SDK配置開始,這會爲您節省大量時間。 –