我现在已经在脚本中了,并希望将它放在msbuild中。
msbuild / t:Build; PipelinePreDeployCopyAllFilesToOneFolder XXXXX \ XXXX.XXX.xxx \ XXXXX.XXXX.XXXXX1.csproj / p:Configuration =“Release”; _ PackageTempDir = .... \ Deploy \ XXXX1
msbuild / t:Build; PipelinePreDeployCopyAllFilesToOneFolder XXXXX \ XXXX.XXX.xxx \ XXXXX.XXXX.XXXXX2.csproj / p:Configuration =“Release”; _ PackageTempDir = .... \ Deploy \ XXXX2
如何在msbuild脚本中编写?我只是设法用一个版本来创建,但是在Deploy文件夹中创建了我无法做到的不同文件夹。
有人可以教我吗?
答案 0 :(得分:0)
当您调用msbuild任务来构建项目时,可以将OutDir(新项目)或OutputPath(一些旧项目类型)指定为Properties。或者你想要的任何属性,比如你的“_PackageTempDir”
这样的事情:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BatchMyProjects" ToolsVersion="4.0">
<ItemGroup>
<BuildMyProjects Include="XXXX-Project-1" />
<BuildMyProjects Include="XXXX-Project-2" />
</ItemGroup>
<Target Name="BatchMyProjects" >
<ItemGroup>
<ProjectsToBuild Condition="Exists('SomeSourcePath\%(BuildMyProjects.Identity)/%(BuildMyProjects.Identity).csproj')">
<ProjectName>SomeSourcePath/%(BuildMyProjects.Identity)/%(BuildMyProjects.Identity).csproj</ProjectName>
<PublishSubFolder>%(BuildMyProjects.Identity)</PublishSubFolder>
</ProjectsToBuild>
</ItemGroup>
<MSBuild Projects="%(ProjectsToBuild.ProjectName)" Targets="Build;PipelinePreDeployCopyAllFilesToOneFolder"
Properties="Configuration=Release;
OutDir=SomePathToDeploy/Deploy/%(ProjectsToBuild.PublishSubFolder)/;
OutputPath= SomePathToDeploy/Deploy/%(ProjectsToBuild.PublishSubFolder)/;
_PackageTempDir=SomePathToDeploy/Deploy/%(ProjectsToBuild.PublishSubFolder)/
" />
</Target>
</Project>
答案 1 :(得分:0)
这确实有效,但这看起来有点奇怪。我宁愿让它像你提到的那样工作
<Target Name="testar" >
<MSBuild Projects="..\xxxxxx\xxxxxx1.csproj" Targets="Build;PipelinePreDeployCopyAllFilesToOneFolder" Properties="Configuration=Release;_PackageTempDir=../../Deploy/xxx1/"/>
<MSBuild Projects="..\xxxx\xxxxxx2.csproj" Targets="Build;PipelinePreDeployCopyAllFilesToOneFolder" Properties="Configuration=Release;_PackageTempDir=../../Deploy/xxx2/"/>
</Target>