MSBUILD batch targets
- by Darthg8r
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