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

Comments

  • Anonymous
    June 20, 2011
    Thanks for this post!  Quick question.  If I do this in a production environment, will i have any effects like resetting the app pool, loss of user session, etc?

  • Anonymous
    March 13, 2012
    Steve G.  You shouldn't see any negative side-effects.

  • Anonymous
    June 24, 2014
    I have 2 webpage need to deploy: 1.Admin.SendMessage.aspx 2.App_Web_admin.sendmessage.aspx.f9b0821e.dll I added one more admin.sendmessage.aspx.f9b0821e.compiled I copy 3 file to bin folder. I do this, but when i click one button on my web page, it do nothing. Seem App_Web_admin.sendmessage.aspx.f9b0821e.dll not running What's reason, help!