How do I compile an ASP.NET website into a single DLL file?

49,659

Solution 1

You might prefer to use the web application project style for that.

You can use ILMerge to merge assemblies into one.

Solution 2

The way we do it is by adding a deployment project to our site:

http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx

Solution 3

To accomplish this you will have to covert your project into a Web Application Project (Supported in Visual Studio 2005 SP1 and Visual Studio 2008).

The process of converting is not that hard, but you will need to move everything out of the app_code folder, as WAP (Web Application Projects) projects do not have code inside app_code.

Once you do this, everything inside your project is compiled into a single DLL file, any external assemblies are still contained in their own DLL files though, but there are options around that as well.

Solution 4

We use build scripts for our websites and run the aspnet_merge.exe from the command line. Here's the MSDN page: http://msdn.microsoft.com/en-us/library/bb397866.aspx

Share:
49,659
Scott and the Dev Team
Author by

Scott and the Dev Team

I was very young at birth, but have progressively aged since. I failed my way into software development, and I am very grateful to the medium that saved me from a lifetime of busing tables. I currently develop custom internet based productivity software.In 1984 I was voted "Most Likely to Fail Miserably" by the most cherished members of my extended family. Now I have the habit of waving my paychecks in their collective face at family get-togethers. I am not bitter, just happy.

Updated on August 21, 2020

Comments

  • Scott and the Dev Team
    Scott and the Dev Team over 3 years

    I have finally finished my web site. I published it, and I was surprised at the results. Although the App_Code compiled into a single DLL file, every page's code behind compiled into its own DLL file. How do I make it so that it is one DLL file?

    Also, is it possible to compile everything (SubSonic, AJAX, etc.) into that same single DLL file?