How to make msbuild ItemGroup items be separated with a space rather than semi-colon?

Posted by mark on Stack Overflow See other posts from Stack Overflow or by mark
Published on 2010-06-09T18:55:51Z Indexed on 2010/06/10 6:53 UTC
Read the original article Hit count: 288

Filed under:

Dear ladies and sirs.

Observe the following piece of an msbuild script:

<ItemGroup>
  <R Include="-Microsoft.Design#CA1000" />
  <R Include="-Microsoft.Design#CA1002" />
</ItemGroup>

I want to convert it to

/ruleid:-Microsoft.Design#CA1000 /ruleid:-Microsoft.Design#CA1002

Now, the best I came up with is @(R -> '/ruleid:%(Identity)'), but this only yields

/ruleid:-Microsoft.Design#CA1000;/ruleid:-Microsoft.Design#CA1002

Note the semi-colon separating the two rules, instead of a space. This is bad, it is not recognized by the fxcop - I need a space there.

Now, this is a simple example, so I could just declare something like this:

<PropertyGroup>
  <R>/ruleid:-Microsoft.Design#CA1000 /ruleid:-Microsoft.Design#CA1002</R
</PropertyGroup>

But, I do not like this, because in reality I have many rules I wish to disable and listing all of them like this is something I wish to avoid.

© Stack Overflow or respective owner

Related posts about msbuild