ASP.NET Web Deployment Projects: getting rid of .compiled files

asp.netdeploymentweb-deployment-project

I'm using a Web Deployment Project in Visual Studio 2008 in order to prepare my ASP.NET application (ASP.NET web application, not ASP.NET web site) for being copied to several servers. I have to copy the files on local staging servers, on different servers via FTP and sometimes I have to fetch them from customers' servers.

So, it would be nice to have all files for deployment in a compact form without the necessity of doing a lot of comparing between source and destination. Web deployment projects have this nice feature: compile all your aspx and ascx files into a single (additional) assembly.

I somehow found out how to get rid of aspx placeholder files on the server, now I'd like to know if there is a (maybe self-made) way to get rid of these .compiled files.

From Rick Strahl's blog:

The .Compiled file is a marker file
for each page and control in the Web
site and identifies the class used
inside of the assembly. These files
are not optional as they map the ASPX
pages to the appropriate precompiled
classes in the precompiled assemblies.
If you remove the .Compiled file, the
page that it maps will not be able to
execute and you get a nasty execution
error.

Anybody out there with a creative idea, maybe using a module/handler which intercepts the check against the .compiled files in the bin folder?

Best Answer

The .compile file comes from pre-compiling on deployment. So you basically have 3 options:

  1. Keep the .compiled file
  2. Don't pre-compile and deploy source code
  3. Turn this in to a Web Application instead of a Web Site and compile as an assembly

I have run in to the same problem myself. I actually choose #1 in most cases when dealing with deployment of Web Sites, but on the rare occasion when I know I am going to have to maintain the site for an extended period of time, I take the time to upgrade it to a Web Application.