Updating a DLL in a Production ASP.NET Web Site bin folder
Asked Answered
C

3

13

I want to update a class library (a single DLL file) in a production web application. This web app is pre-compiled (published). I read an answer on StackOverflow (sorry, can't seem to find it anymore because the Search function does not work very well), that led me to believe that I could just paste the new DLL in the bin folder and it would be picked up without problems (this would cause the WP to recycle, which is fine with me because we do not use InProc session state).

However, when I tried this, my site blows up and gives a FileLoadException saying that the assembly manifest definition does not match the assembly reference. What in the world is this?! Updating the DLL in Visual Studio and re-deploying the entire site works just fine, but it is a huge pain in the rear. What is the point of having a separate DLL if you have to re-deploy the entire site to implement any changes?

Here's the question: How can I update a DLL on a production web site without breaking the app and without re-deploying all of the files?

Choose answered 31/3, 2010 at 15:45 Comment(1)
This is a "web site" in Visual Studio, by the way. Not sure if that makes a difference or not.Choose
K
10

The thing to remember is that there are web sites and web applications as far as Visual Studio and ASPNET is considered.

Web Sites typically have all of the aspx and vb files published to the live server and ASPNET Worker Process recompiles the app every time before presentation.

On the other end is the web application, where all of your code behind files get compiled down to a single DLL file and you simply deploy your aspx pages and you bin folder with the DLL file to production.

There is also a "hybrid" known as "Precompiled Web Sites" (see the link for the official MSDN overview) where you don't have the single DLL layout of a web application, but all the compile work of the website is done for you. There are several "modes" to this depending on your needs.

It seems to me that your error is caused because your site is set up as a web site with some kind of precompilation in place. Using the pre-compiled model is a little more "strict" in that is assumes certain files/signatures are in place. Having an updated version of the DLL file causes a break since the precompilation wants a name and a version of the file.

If possible, your best bet would be to convert to a web application, since you can add the additional DLLs into production without a problem. Otherwise, take a look at this matrix to see what form of precompilation you need for your application.

Keramic answered 31/3, 2010 at 18:44 Comment(6)
+1 Thanks, this is a good answer. I am still somewhat confused on the web application conversion process. What is exactly involved with "converting to a web application"? Thanks again!Choose
You should be able to right click on the project file and select "Convert to Web Application" and it will do the process for you.Keramic
I do not have the "Convert to Web Application" option in my solution explorer context menu. I have VS2008 professional edition. I am not blind, it simply is not there! Is there some kind of add-on that I need for this? Thanks.Choose
I believe the option is in the context menu of the project, not the solution. Try there.Keramic
@Dillie I have tried everything and I simply do not have a "Convert to Web Application" option. I've been searching around trying to figure out if there is some special version of VS or maybe a service pack that I don't have installed or something but it appears I am up to date on everything!Choose
Seems odd. Can you right click on your project to display the context menu in the solution explorer and then update the question with that screen shot? There may be something I'm missing here.Keramic
G
1

Look at this SO post, might be what you are referring to. The located assembly's manifest definition does not match the assembly reference

Gujarat answered 31/3, 2010 at 15:53 Comment(1)
That's not the one. It had an answer that said something to the effect of "Yes just drop yuor new DLL in the bin folder and it will recycle the app pool and get picked up." It was an accepted answer and had been up voted a few times. I left a comment on the answer about FileLoadException.Choose
S
0

Have a look at your reference. Does it say "specific version = true" ? Set it to false, republish your app (you have to do it once, because now your app is still looking for an assembly with a specific manifest) and try it again.

Smokeproof answered 31/3, 2010 at 16:1 Comment(5)
Where do I find this "specific version"?Choose
In the reference properties. Expand references, right click on the specific reference, click properties.Gujarat
I cant find what you are talking about. This is a web site, not a web application.Choose
Hmm well you said "web app" first. Then my awswer is not applicable to your situation.Smokeproof
Well, it is a web application, per se. But Visual Studio decided to come up with its own stupid terminology to confuse everybody. According to VS, this is a web site.Choose

© 2022 - 2024 — McMap. All rights reserved.