MSBuild Script and VS2010 publish apply Web.config Transform

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-05-25T13:40:53Z Indexed on 2010/05/25 15:31 UTC
Read the original article Hit count: 1096

Filed under:
|

So, I have VS 2010 installed and am in the process of modifying my MSBuild script for our TeamCity build integration. Everything is working great with one exception.

How can I tell MSBuild that I want to apply the Web.conifg transform files that I've created when I publish the build...

I have the following which produces the compiled web site but, it outputs a Web.config, Web.Debug.config and, Web.Release.config files (All 3) to the compiled output directory. In studio when I perform a publish to file system it will do the transform and only output the Web.config with the appropriate changes...

    <Target Name="CompileWeb">
        <MSBuild Projects="myproj.csproj" Properties="Configuration=Release;" />
    </Target>

    <Target Name="PublishWeb" DependsOnTargets="CompileWeb">
        <MSBuild Projects="myproj.csproj"
        Targets="ResolveReferences;_CopyWebApplication"
        Properties="WebProjectOutputDir=$(OutputFolder)$(WebOutputFolder);
                    OutDir=$(TempOutputFolder)$(WebOutputFolder)\;Configuration=Release;" />
    </Target>

Any help would be great..!

I know this can be done by other means but I would like to do this using the new VS 2010 way if possible

© Stack Overflow or respective owner

Related posts about msbuild

Related posts about VS2010