I heed to extend the current value of
DefineConstants property of my
csproj-file. The string, which I want to add as a suffix, can be evaluated on C# through the such way:
Int32 min_year = 2009;
Int32 target_year = 2015;
String result = String.Join(";", Enumerable.Range(min_year, target_year -
min_year + 1).Select(n=>"NEWER_THAN_AUTOCAD_" + (n - 1)).ToArray());
// result:
// NEWER_THAN_AUTOCAD_2008;NEWER_THAN_AUTOCAD_2009;
// NEWER_THAN_AUTOCAD_2010;NEWER_THAN_AUTOCAD_2011;
// NEWER_THAN_AUTOCAD_2012;NEWER_THAN_AUTOCAD_2013;
// NEWER_THAN_AUTOCAD_2014
I need to do the same logic in the
MSBuild code... I try to do it through this way:
$([System.String]::Join(`;`,[System.Linq.Enumerable]::Range(2009,[MSBuild]::Add(
[MSBuild]::Subtract($(CAD_Year),2009),1)).Select(n=>[System.String]::Concat(
"NEWER_THAN_AUTOCAD_"),[MSBuild]::Subtract(n,1).ToArray()))
But I get this expression in the
DefineConstants property instead of evaluated value. How can I do the same in the
MSBuild?