Last post Mar 27, 2015 10:58 AM by D4v1d
Mar 25, 2015 12:30 PM|D4v1d|LINK
I have a web application project with a handful other projects supporting it. Those projects have a handful of 3rd party dependencies. I have a publish profile setup on the web application project which is set to pre compile the web application. The Advanced
Precompile Settings are set to "Merge all outputs to a single assembly" and "Treat as library component". The precompiled site is NOT updatable. The publish profile publishes the web application to the file system. This works great. I can build the solution
using MSBuild and this produces a folder I can drop on to a test server and the web app just works.
Now I have to think about packaging this web app up for retail deployment. I already have an obfuscation product (CryptoObfuscator) which I have used for several years. I can obfuscate the web application assemblies produced from the publish, everything
still works when deployed to the test server.
Now comes the problem.. I want to merge all of the assemblies for the web application in to a single DLL file. There likely ~15 of them in the bin folder, some mine, some 3rd party. There are a large number of .compiled files in the bin folder. In each of
the .compiled files there is a assembly tag that references one of 2 assemblies. The .ascx and .aspx files are referencing the dll produced by the "Merge all outputs to a single assembly" publish (WebApplicationMerged.dll). The .ashx and .asmx files are referencing
the dll produced by just building the web application (WebApplication.dll).
If I merge WebApplication.dll with all other assemblies the result is when trying to access the main page of the site I get the error "The file '/Home.aspx' has not been pre-compiled, and cannot be requested."
If I merge WebApplication.dll with all other assemblies EXCEPT WebApplicationMerged.dll, the result is that I can access the main page of the site just fine. In fact, I can access all aspx pages. If I try and access a handler or web service file I get the
error "The file '/Handler.ashx' has not been pre-compiled, and cannot be requested."
It seems to me (and based on some of the information found elsewhere) that the .compiled files hold the key to the problem. After the assemblies are merged, the .compiled files now have an invalid hash or filehash. Is there a way to recalculate these hashes
after using an assembly merge tool (like ILMerge).
Anyone have a solution to this problem? I am using VS2013update4, .Net4.5.1. I have tried using the assembly merge of CryptoObfuscator as well as just using ILMerge directly. The results seem the same.
Mar 26, 2015 10:36 PM|Angie xu - MSFT|LINK
Now comes the problem.. I want to merge all of the assemblies for the web application in to a single DLL file.
The ASP.NET Merge tool merges the output of the ASP.NET Compilation tool into fewer assemblies or a single assembly. This can make release management and deployment easier for large Web sites. You can merge all compiler outputs into a single assembly.
Check out ASP.NET Merge Tool (Aspnet_merge.exe) for further information.
You can also use Merge all outputs to a single assembly option to do that.
Mar 27, 2015 10:58 AM|D4v1d|LINK
I am aware of those settings in visual studio and that is indeed how my project is setup. The ASP.NET Merge tool merges the
output of the ASP.NET Compilation tool
into fewer assemblies or a single assembly. I want to merge *ALL* of the assemblies in the bin folder into one assembly, not just those produced by the ASP.NET Compilation tool. I have done this many times with console apps, windows
services, and even win forms apps. I am trying to figure out if it possible to make this work for an ASP.NET web application. I can merge all the assemblies (and I can even verify the merged assembly in ILSpy), but then ASP.NET no longer recognizes the merged
assembly as part of the web application. Again I think it has to do with the .compiled files. This may not even be possible (or supported?), because I have been unable to find any evidence (in documentation or forum posts) that anyone has actually done it.
Either that, or I am missing something so blatantly obvious no one else has needed to ask the question