MSBUILD batch targets

Posted by Darthg8r on Stack Overflow See other posts from Stack Overflow or by Darthg8r
Published on 2012-11-01T15:31:04Z Indexed on 2012/11/01 17:01 UTC
Read the original article Hit count: 255

Filed under:

I want to deploy an application to a list of servers. I have all of the build issues taken care of, but I'm having trouble publishing to a list of servers. I want to read the list of servers from an external file and call a target passing the name of each server in.

<ItemGroup>
    <File Include="$(SolutionFolder)CP\Build\DenormDevServers.txt" />
</ItemGroup>

<Target Name="DeployToServer" Inputs="Servers" Outputs="Nothing">
    <Message Text="Deployment to server done here.  Deploying to server: @(Servers)" />
</Target>

<Target Name="Test">
    <ReadLinesFromFile File="@(File)">
        <Output TaskParameter="Lines" ItemName="Servers" />
    </ReadLinesFromFile>

    <CallTarget Targets="DeployToServer" ContinueOnError="true"></CallTarget>
</Target>

I can't seem to get it to "Deploy" to each server in the list. The output looks like this:

Deployment to server done here.  Deploying to server:

Notice there is no server name, nor is done more than once. There are 2 lines in DenormDevServers.txt

© Stack Overflow or respective owner

Related posts about msbuild