2017-08-03 57 views
0

我有一個MSBuild XML文件與一些目標,一些是幾個項目文件,一些是完整的解決方案。MSBuild:如何構建所有配置/平臺組合的目標?

我正在尋找一種方法可以做一些類似如下:

MSBuild.exe build.xml /target:Target1 /p:Configuration="Debug;Release" /p:Platform="x86;x64" /m 

而且具有的MSBuild揭開序幕構建每個項目在目標1的配置和平臺的每個組合:

Debug|x86 
Debug|x64 
Release|x86 
Release|x64 

(也最好是並行)

我已經找到一種方法來做到這一點的一個倍數(如配置或平臺),但不能同時使用ItemGroups但如果我嘗試在第二個乘法器中添加它不起作用,並且會像這樣結束:

Debug|<blank> 
Release|<blank> 
<blank>|x86 
<blank>|x64 

感謝您的閱讀!

+0

您可能需要交叉產品,例如https://stackoverflow.com/questions/15914145/cross-join-itemgroups-in-msbuild#15928871 – stijn

回答

0

MSBuild:如何構建所有配置/平臺組合的目標?

如果你想建立所有configuartions爲build.xml,你需要設置屬性用於此項目,例如建四次:

MSBuild.exe build.xml /target:Target1 /p:Configuration="Release" /p:Platform="x86" 

或寫的MSBuild腳本來做到這一點:

<?xml version="1.0" encoding="utf-8"?> 
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <Target Name="Build"> 
     <MSBuild Projects="a.sln" Properties="Configuration=Debug;Platform=x86" /> 
     <MSBuild Projects="a.sln" Properties="Configuration=Debug;Platform=x64" /> 
     <MSBuild Projects="a.sln" Properties="Configuration=Release;Platform=x86" /> 
     <MSBuild Projects="a.sln" Properties="Configuration=Release;Platform=x64" /> 
    </Target> 
</Project> 

如果這些方法不夠有效,可以考慮在stijn的評論中交叉聯結ItemGroups。

相關問題