我試圖避免硬編碼設置到我的.vcxproj文件。我想編輯一個文件,即繼承的屬性表(.props),以更改我的設置。這對編譯器和鏈接器設置非常有用。我還將這種技術用於所有我的依賴庫,如boost,zlib,用於追加包含路徑和libpath。我可以使用屬性表來生成項目配置嗎?
我想借此步驟更遠創建在一個屬性表配置的列表。 這是可能的。我不斷收到錯誤。
proj1.vcxproj
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="configurations.props"/>
<PropertyGroup Label="Globals">
<ProjectGuid>{36327322-B9FA-4D71-1111-E94F5BB55D57}</ProjectGuid>
<RootNamespace>Proj1</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
configurations.props
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="DebugUnicode|Win32">
<Configuration>DebugUnicode</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
</Project>
proj1.vcxproj:錯誤:項目 「proj1」 不包含任何 配置。該項目無法加載。
這是可能的嗎?
檢查瞭解可能的解決方法。 http://stackoverflow.com/a/14755704/259543 – alecov