2016-11-12 31 views
1

我在定義爲C#項目Condtional編譯符號「ABC,XYZ」,我可以使用該項目的XML文件中的下列人員的MSBuild在有條件包含的項目代碼文件:如何讓MSbuild只使用其中一個「DefineConstants」進行條件測試?

<Compile Include="SomeFile.cs" Condition="$(DefineConstants)'=='ABC;XYZ'"/> 

但我需要像下面的東西不起作用:

<Compile Include="SomeFile.cs" Condition="$(DefineConstants)'=='ABC'"/> 

是否有可能只使用一個defineconstants進行條件測試?

回答

1

我想通了... this link幫助。

基本上,你只需要看看字符串,看看它是否包含你想基於你的條件的標籤。在我的情況下,這是它的代碼:

<Compile Include="SomeFile.cs" Condition="$(DefineConstants.Contains('ABC'))" /> 
相關問題