views:

789

answers:

2

All,

I currently have my solution comprising of 2 Class librarys and a Web Site building within teamCity using Msbuild. Now I want to precompile the website and make it available as an artifact. However when i try to Precompile it using

<Target Name="PrecompileWeb" DependsOnTargets="Build">
    <AspNetCompiler
        PhysicalPath="$(BuildDir)\Location\" 
        TargetPath="$(BuildDir)\Publish"
        Force="true"
        Debug="true"

        />
  </Target>

I get an error becasue it is looking for a virtual path (which i don't have as all I want to do it precompile the files I am not interested in publishing the site) if I put a dummy path in I get another error (correctly) about it not being an application under IIS

Any ideas

+2  A: 

Hi Dean,

Is this a Web Site or Web Application Project? If the latter, instead of doing an AspNetCompiler task, do an MSBuild task to the csproj/vbproj file, calling the targets Rebuild;ResolveReferences;_CopyWebApplication and specifying the OutDir property.

If you are using a website, then specify the VirtualPath to be a valid IIS path. What is happening is that, when you don't specify the VirtualPath property, it tries to resolve it using the PhysicalPath and IIS. I believe that's just an artifact of how the AspNetCompiler works.

Cory Foy
@Cory - So the _CopyWebApplication target with an OutDir is what does the precompilation? Also, to do this, the targets need to be all these Rebuild;ResolveReferences;_CopyWebApplication or it fails? Thanks.
nickyt
A: 

Hi Cory

I am not sure this will work as this will happen on every build? I only want to do this when I run the build on the TeamCity Server not local builds.

Essentially I currently

Build all the required solutions Execute the unit tests Create the Zip folder for the artifact

Cheers

Dean