Precompilation for Deployment

1.9k views Asked by At

After exploring Precompilation for Deployment topic I want to enhance my build process. Now, what I do is:

  • prepare web site using Web One Click Publish, for instance to c:\www\app directory, and that directory is available in IIS via app (localhost/app)
  • I launch aspnet_compiler.exe -v app c:\www\appprecompiled -f

Now I have ready precompiled application in c:\www\appprecompiled and everything is fine. However my application is quite big, and Publishing it (step 1) take about 5 minutes from scratch. So I wonder if it is possible to avoid step one , and perform step 2 (precompilation) with source folder pointing to solution folder. I tried something like this:

aspnet_compiler.exe -v codeapp c:\code\app -f

Where c:\code\app is the folder with web.config etc files, basically it's a project with web site and that folder is avaliable via http://localhost/codeapp.

But when launching that command, I get errors about missing global.asax or web.config errors:

C:\code\app\obj\debug\package\packagetmp\web.config(18): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

And for the record, I use Application, not Virtual Directory.

So is there a way to perform precompilation on a plain web site folder?

1

There are 1 answers

0
dragonfly On BEST ANSWER

I used

aspnet_compiler -p physicalOrRelativePath -v / targetPath

from http://msdn.microsoft.com/en-us/library/ms227976(v=VS.80).aspx and removed obj folder prior to executing it, and precompilation works :)