How can I deploy a single ASP.NET web page to a web site that is precompiled?

Every now and then, you may find yourself in the situation where you need to deploy a single file on a precompiled web site.  I know I certainly have.

Here are the steps that I would use to accomplish this:

  1. Build and precompile your whole web site as usual;
  2. Search in the "Bin" folder of the build output web site folder for the file you want to deploy with a .compiled file extension;
  3. Once found, open the file in a text editor like Notepad.exe (The .compiled file should contain an XML element called preserve that lists the assembly name and the virtual path where you can verify you have the file you want to deploy);
  4. Copy the .dll assembly file named in the XML and the .compiled file to the "Bin" folder of the web site that you want to deploy to;
  5. Done.

 

Example of XML contents of a file called default.aspx.cdcab7d2.compiled:

XML contents of a file

 

In the example above, the following two files would be copied to the Bin folder of the web site being deployed to:
App_Web_default.aspx.cdcab7d2.dll
default.aspx.cdcab7d2.compiled

 

For more information on precompiling a web site:
https://blogs.msdn.com/perfworld/archive/2009/01/29/how-can-i-precompile-my-asp-net-web-pages-so-that-the-first-user-accessing-the-web-site-doesn-t-experience-slow-performance.aspx