Off and on for the last 5 hours, I've been trying to find out exactly how DLLs are handled and can be deployed within Visual Studio 2005 (ASP .NET 2.0). My issue is this:
When I drag a third party component (control) I'm using, onto an aspx web page, it correctly, automatically, (a) adds a link (create a reference) to the file in the Global Assembly Cache (GAC) and (b) adds an assembly reference in the web.config file. What it doesn't do however, is copy the necessary DLL to the Bin folder of the project!
This "not copying to local" as I term it, becomes an obvious problem at the imminent deployment stage, well, that's unless you always have the same GAC on your development machine as on the production server! (Hardly ever the case!) So, for the morning I've been trying to decide how best to handle this situation.
Another option would've been to find the DLLs and manually copy them to the application's Bin directory.. The problem with this however would be that you most probably would get a "ambiguous reference" error as VS2005 wouldn't know whether to use the DLL from the GAC or from the Bin folder.
Ok, after all that background info, I'll stop boring you and move on to the solution I've found.. . Simply, let the stuff I said in Paragraph #2 happen.. but when coming to deployment, where you'll need the DLLs to be on the production server, you can do the following: In Visual Studio Project, select the Bin folder but instead of going to "Add Reference...", use "Add Existing Item". When the window opens, navigate to the needed DLLs, click 'Ok' and then sit back and let VS2005 adds them to the Bin folder.. Once this is done you're ready for deployment..
One of the best things I think about this solution is that the references in the web.config folder are maintained.. So if on the production server, the files are in the GAC, I expect it'll use them from there, or, if they're not, it'll use the ones in the Bin folder (not 100% sure about this last part though, just going on "tech sense").
Enjoy!
tagged: professional // Comments [0]
Related posts:Select a random row in MS SQL...Regular expressionsMS's ASP.NET and.. PHP2-way databinding cascading drop down lists within a FormViewApplicationName Property when customising providersFormatting strings/numbers in .NET
Disclaimer The posts on this blog are provided "AS IS" with no warranties. The opinions expressed herein are my own personal opinions and do not represent any other person's views in anyway.