Reputation: 126
In reworking our deployment process I moved over to using an MSBuild project in place of our existing batch files. All of the major elements are in place, and I was looking to cut out a step or two but ran into a snag.
I'm creating a property called OutputPath using the CombinePath task, and, while I can access it with no issues after it has been created I'm at a loss as for how to use it to my advantage. Consider:
<CombinePath BasePath ="$(DeployFolderRoot)" Paths ="$(DeployReleaseFolder)$(ReleaseFolderFormatted)" >
<Output TaskParameter ="CombinedPaths" ItemName ="OutputFolder"/>
</CombinePath>
<MakeDir Directories="@(OutputFolder)" />
<MakeDir Directories="@(OutputFolder)\Foo" />
<MakeDir Directories="@(OutputFolder)\Bar" />
Commands 2 and 3 fail because I'm referencing an array and attempting to concatenate with a string. Creating a property and assigning it @(OutputFolder) simply results in another item group, not a property I can reference with the $ accessor. I do have an ugly workaround but I'd love to clear this up somewhat.
Thanks,
-Jose
Upvotes: 0
Views: 1817
Reputation: 126
dOh! Definitely ignorance, used the wrong attribute on the Output element.
<CombinePath BasePath ="$(DeployFolderRoot)" Paths ="$(DeployReleaseFolder)$(ReleaseFolderFormatted)" >
<Output TaskParameter ="CombinedPaths" PropertyName="OutputFolder"/>
</CombinePath>
<MakeDir Directories="$(OutputFolder)" />
<MakeDir Directories="$(OutputFolder)\Foo" />
<MakeDir Directories="$(OutputFolder)\Bar" />
Upvotes: 1
Reputation: 13655
I'm not sure of the answer exactly but here is an idea:
<CombinePath BasePath ="$(DeployFolderRoot)" Paths ="$(DeployReleaseFolder)$(ReleaseFolderFormatted)" >
<Output TaskParameter ="CombinedPaths" ItemName ="OutputFolder"/>
</CombinePath>
<OutputFolder Include="$(DeployFolderRoot)$(DeployReleaseFolder)$(ReleaseFolderFormatted)\Foo" />
<OutputFolder Include="$(DeployFolderRoot)$(DeployReleaseFolder)$(ReleaseFolderFormatted)\Bar" />
<MakeDir Directories="@(OutputFolder)" />
Essentially, if you create OutputFolder items with the path they will just be appended to the list. This would have to be in an element btw, and you have to use Include="".
Upvotes: 3