Problems with automatically pre-compiling a website with MSbuild

All,

I currently have a solution including 2 class libraries and building a website within teamCity using Msbuild. Now I want to precompile the website and make it available as an artifact. However, when I try to recompile it using

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

        />
  </Target>

      

I get an error because it looks for a virtual path (which I don't have, since all I want to do is precompile files that I'm not interested in when publishing the site) if I put the dummy path in another error (correct ) about this is not an application in IIS

Any ideas

+1


source to share


2 answers


Is this a website or web application project? If the latter, instead of executing the AspNetCompiler task, executes the MSBuild task in the csproj / vbproj file by calling targets Rebuild;ResolveReferences;_CopyWebApplication

and specifying the property OutDir

.



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

+2


source


I'm not sure if this will work as it will happen in every build? I only want to do this when I run a build on TeamCity Server and not local builds.

Essentially I am currently



Build all necessary solutions Run unit tests Create Zip folder for artifact

Greetings

0


source