Of course, this can be done using a custom MSBuild script. Here we start pre-compiling our ASP.NET MVC 3 website (and not that it really depends on the version of ASP.NET).
First, it starts the normal build by running MSBuild against the solution file, then it runs this custom MSBuild code:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<PropertyGroup>
<WebProject>Web\ChatPast.Web\ChatPast.Web.csproj</WebProject>
<WebProjectFolder>Web\ChatPast.Web</WebProjectFolder>
<WebPublishFolder>ChatPastWebPublish</WebPublishFolder>
</PropertyGroup>
<ItemGroup>
<ZipFiles Include="$(teamcity_build_workingDir)\src\ChatPast\$(WebPublishFolder)\**\*.*" />
</ItemGroup>
<Target Name="Build">
<MSBuild Projects="ChatPast.sln" Properties="Configuration=Release"/>
<RemoveDir Directories="$(WebPublishFolder)"/>
<MakeDir Directories="$(WebPublishFolder)"/>
<MSBuild Projects="$(WebProject)"
Targets="ResolveReferences;_CopyWebApplication"
Properties="Configuration=Release;WebProjectOutputDir=..\..\$(WebPublishFolder);OutDir=..\..\$(WebPublishFolder)\bin\" />
</Target>
</Project>
source
share