开发者

msbuild String to Array

I am building a string with the PowershellTaskFactory that returns a list of files separated with a semicolon.

When I try to pass this to my in Wix it is interpret开发者_开发百科ed as a string. I've been fighting it for quite a while now and decided to reach out. What I really want is a list of wxs to be passed to wix's candle application and I thought MsBuild would recognize that the string contained the delimiter and split it up...but it gets passed to candle as a string argument.

Update- Solved

I ended up using the new MSBUILD 4.0 feature of Property Functions, similar to this

 <Compile Include="$(builtString.Split(';'))"/>


Take the string, which is a property, and convert it to an item array,

<PropertyGroup>
    <ListOfFilesFromPowerShell>a.wxs;b.wxs;c.wxs</ListOfFilesFromPowerShell>
</PropertyGroup>

<ItemGroup>
    <ListOfFilesFromPowerShell Include="$(ListOfFilesFromPowerShell)" />
</ItemGroup>

Now, use @(ListOfFilesFromPowerShell) instead of $(ListOfFilesFromPowerShell). When you say "passed to wix's candle application" I'm assuming you mean passed on the command line to candle.exe using the Exec task, or something similar, which would look like this,

<Exec
    CommandLine="candle.exe @(ListOfFilesFromPowerShell, ' ') ..."
    ...
    />

This will give the following command line,

candle.exe a.wxs b.wxs c.wxs ...

The special syntax [, ' '] on the item array is used to supply an alternate separator character.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜