I've read a few good posts on automating build processes, however, what I'm interested in is not just a build process, but publishing.
I have several websites and services that use a base model. When I change that model (which won't happen very often), all sites/services will have to be rebuilt and published to their appropriate target directories (already contained in their config).
All project folders exist in one folder.
The approach I am considering is to use MSBuild to run a script from the the main folder, with a named list of projects to build/publish.
I have found a good example on creating a build script for MSBuild here, however, this only satisfies the build for one project.
How would I have the process go through a named list of projects/directories to perform the same build/publish script on?
Thanks.
So I finally had time to take a look at this again.
I created the following MSBuild script that resides in a folder at the same level of all the websites I have.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name ="DeleteFiles">
<Delete Files="..\$(ProjectName)\$(ProjectName)\obj\debug\$(ProjectName).dll"></Delete>
<Delete Files="..\$(ProjectName)\$(ProjectName)\obj\release\$(ProjectName).dll"></Delete>
<Delete Files="..\$(ProjectName)\$(ProjectName)\bin\$(ProjectName).dll"></Delete>
<Delete Files="..\$(ProjectName)\$(ProjectName)\bin\$(ProjectName).pdb"></Delete>
</Target>
<Target Name="Compile" DependsOnTargets="DeleteFiles">
<MSBuild Projects="..\$(ProjectName)\$(ProjectName)\$(ProjectName).csproj"
Targets="Clean;Build"
Properties="OutputPath=..\$(ProjectName)\bin"/>
</Target>
<Target Name="Deploy" DependsOnTargets="Compile">
<MSBuild Projects="..\$(ProjectName)\$(ProjectName)\$(ProjectName).csproj"
Targets="ResolveReferences;_CopyWebApplication"
Properties="OutDir=C:\inetpub\wwwroot\$(ProjectName)\bin\;WebProjectOutputDir=C:\inetpub\wwwroot\$(ProjectName)" />
</Target>
</Project>
And is called like this:
msbuild build.xml /p:ProjectName="websitetopublish.com" /v:n
Works great for one site, however I'd like a batch-related solution that reads a text file. For each entry in that text file execute the build process.
I easily write a .Net console app to to this, but overkill, and I'd like to know how to accomplish this using some for looping mechanisms in batch files.