tags:

views:

55

answers:

2

I have an ASP.NET web application which contains a DLL in the /bin folder 'Example.dll'. If I do not have any mention of 'Example.dll' in the Web.config, is it safe to simply replace it with a newer version of 'Example.dll', and the application will use it?

If not, what steps are needed?

+1  A: 

Replacing the DLL will trigger the App Domain (the entire web application) to restart, any code using this DLL will use the new version upon restart. Current requests to the old one will complete, then shutdown.

So no additional steps are needed, just be aware the application will restart.

Nick Craver
+4  A: 

Yes, that's safe (assuming you've been careful and not made any breaking changes), but here's a tip I learned from bitter experience: don't backup the old version within the same folder. Even if you rename it something like Example.dll0, it may still confuse the framework.

Also, doing so will restart the app.

pdr
In my experience, this could very easily result in a `FileLoadException` with the message "Could not load file or assembly or one of its dependencies. The located assembly's manifest definition does not match the assembly reference." In fact, I just encountered this the other day when trying to replace a DLL, ended up having to re-deploy the entire application. I think it depends on your deployment strategy. For instance, the application in this case was precompiled.
Josh Stodola
I've never experienced that, Josh, and all my apps are precompiled. However, I guess if it was in the middle of a process and it (for whatever reason) wanted to complete before recycling the app, it might happen. Once the app is restarted, I can't see why it would be looking for the old DLL.
pdr
I dropped in the new DLL (with no changes that would cause compilation errors) and my app stopped working completely and the event viewer had several of those messages (one per subsequent request). Redeploying the entire app fixed the problem. Just happened to me on Friday.
Josh Stodola