I have a property that has comma-separated values, like "A,B,C,D" and I need to pass it to another target. My current solution is to declare it as items and the pass it to msbuild with batching:
<PropertyGroup>
<MyProperties>A,B,C,D</MyProperty>
</PropertyGroup>
<ItemGroup>
<MyPropertiesAsItems Include="A;B;C;D"/>
</ItemGroup>
<
Target Name="MyTarget"><MSBuild Projects="$(MSBuildProjectFile)"
Properties="MyProperty=%(MyPropertiesAsItems.Identity)"
Targets="MyOtherTarget"/>
</Target>
The problem with this is the redundancy in having to declare both the property and the item. I would like to be able to convert from the property to the item. One possiblity is to create a custom task for it, but I'd like to avoid that.
Does anyone can think of any other way to do this
Best Regards,
Gustavo Guerra

How to translate from Properties to Items?
Bernardm1
BTW, in what exactly does VS use the AvailablePlatforms Property It doesn't seem to need it to populate the platforms in the project properties drop-down menu.
Regards,
Gustavo Guerra
AndyDragon
1.) Modify Microsoft.Common.targets to have a new value for AvailablePlatforms. For example,
<PropertyGroup>
<AvailablePlatforms>Any CPU,x86,x64,Itanium,MyNewPlatform</AvailablePlatforms>
</PropertyGroup>
2.) Inside Visual Studio, create a new C# Console Application.
3.) Right-click on the Solution node in the Solution Explorer, and select "Configuration Manager ...".
4.) In the grid of projects, find the console application project, and in the "Platform" column, click the down-arrow button and select "<New...>".
5.) In the "New Platform" combo box, you should now see "MyNewPlatform" shown in the list.
--Rajeev
David Daniel
Thanks,
Gustavo Guerra
ShaTari
Gustavo Guerra
Roberto_1959
My recommendation would be to write a quick "Split" task that can create an item list for you.
Great questions by the way - keep 'em coming.
Thanks.
Faisal Mohamood
Stef76
<ItemGroup>
<MyItem Include="A;B;C;D" />
</ItemGroup>
You can then very easily use a transform to convert that into a comma separated list - as this:
<Message Text="Comma Separated List: @(MyItem->'%(Identity)',',')" />
You can also create a property dynamically using the CreateProperty task.
<CreateProperty Value="@(MyItem->'%(Identity)',',')">
<Output TaskParameter="Value" PropertyName="MyProperties" />
</CreateProperty>
-faisal