在重新设计部署过程中,我转而使用MSBuild项目代替现有的批处理文件。所有主要元素都已到位,我正在寻找一两步,但遇到了障碍。
我正在使用CombinePath任务创建一个名为OutputPath的属性,虽然我可以在创建它之后没有任何问题地访问它,但我不知道如何使用它对我有利。考虑:
<CombinePath BasePath ="$(DeployFolderRoot)" Paths ="$(DeployReleaseFolder)$(ReleaseFolderFormatted)" >
<Output TaskParameter ="CombinedPaths" ItemName ="OutputFolder"/>
</CombinePath>
<MakeDir Directories="@(OutputFolder)" />
<MakeDir Directories="@(OutputFolder)\Foo" />
<MakeDir Directories="@(OutputFolder)\Bar" />
命令2和3失败,因为我引用了一个数组并尝试与字符串连接。创建属性并分配它@(OutputFolder)只会导致另一个项目组,而不是我可以使用$ accessor引用的属性。我确实有一个丑陋的解决方法,但我很想清楚这一点。
谢谢,
-Jose
答案 0 :(得分:2)
我不确切地知道答案,但这是一个想法:
<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)" />
基本上,如果使用路径创建OutputFolder项,它们将仅附加到列表中。这必须是btw元素,你必须使用Include =“”。
答案 1 :(得分:1)
DOH!绝对无知,在Output元素上使用了错误的属性。
<CombinePath BasePath ="$(DeployFolderRoot)" Paths ="$(DeployReleaseFolder)$(ReleaseFolderFormatted)" >
<Output TaskParameter ="CombinedPaths" PropertyName="OutputFolder"/>
</CombinePath>
<MakeDir Directories="$(OutputFolder)" />
<MakeDir Directories="$(OutputFolder)\Foo" />
<MakeDir Directories="$(OutputFolder)\Bar" />