0

I have right now this in a script and want to have it in a msbuild instead.

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

How would this be written in a msbuild script? I only have managed to do it with one build but to create diffrent folders in the Deploy folder I havent been able to do.

Could someone teach me?

user1540911
  • 355
  • 1
  • 2
  • 12

2 Answers2

0

You can specify OutDir (new projects) or OutputPath (some old project types) as Properties when you call msbuild task to build your project. Or whatever property you want, like your "_PackageTempDir"

Something like this:

<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>

Also I created gist for this same example

Alexey Shcherbak
  • 3,394
  • 2
  • 27
  • 44
0

This do work but that seems abit strange. I rateher have it to work as you mentioned

<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>
user1423277
  • 109
  • 2
  • 13