<p>All, </p>

<p>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 </p>

<pre><code>&lt;Target Name="PrecompileWeb" DependsOnTargets="Build"&gt;
    &lt;AspNetCompiler
        PhysicalPath="$(BuildDir)\Location\" 
        TargetPath="$(BuildDir)\Publish"
        Force="true"
        Debug="true"

        /&gt;
  &lt;/Target&gt;
</code></pre>

<p>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 </p>

<p>Any ideas</p>

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.