I have been given a web service project to work on and I've made it reference a dll. This dll has several other dll's it is dependent on to load. For any other application I've used that needed this dll, I just slapped the dependent dll's in the bin folder. This doesn't seem to work for the web service application, and I get the error stating that "blah.dll failed to load because dependent dll blah blah". My question is where can I put these dependent dll's or what can I configure in visual studio for the web service to find and load the dependant dlls.
Thank you.
*Also, this is for debug purposes only, so the solution doesn't need to be the "correct" way. Anything hacky is fine, as long as I get it to work.
I recommend that you enable the "Copy Local" option on each reference to a non-standard dll. This will ensure that the dlls are copied into the bin directory when you build, and you can easily build a deployment from there. Assuming you are hosting under IIS, it should be as simple as zipping up the bin directory and moving it to your server application directory.
Related
When deploying new builds of applications, I find that applications built by another dev would have the structure:
ApplicationName.exe
ProprietaryClassLibrary.dll
associated config files.
However, when I deploy a version I have built, I start to get "Could not load file or assembly" type errors.
These can be "resolved" by including the named assembly in the application folder. So now I would have (for example):
ApplicationName.exe
ProprietaryClassLibrary.dll
System.Data.SqlServerCe.dll (for example)
But my question is- if these aren't references I've added, and the version hasn't changed, why do I now need to include them in the application folder?
I don't necessarily want to have to include copies of libraries that are already in the GAC or installed elsewhere on the server if I don't need to- but am open to suggestions on best practice.
I have checked my the references' settings in VS to change "Copy Local", "Specific Version" as well as Path, but with limited success.
Any pointers on what might be causing this?
Thanks.
After refactoring a WCF service, the service throws an error saying that it can't find a library that it's no longer supposed to use. The reference to the DLL has been removed from the projects' references, it's not in the config files, and looking through the XML of the .csproj files, there's no artifact reference. The solution has also been cleaned and rebuilt multiple times, the IIS server on which it's running has been restarted, its app pool recycled, and I even found the .cache files in the Debug folder and yet, the app is still complaining that it can't find the DLL it's no longer supposed to use.
Where else could a reference possibly be hiding and what can I do not to have to re-assemble the service file by file, project by project, or calling some sort of .NET exorcist to ensure that the offending DLL isn't there anymore?
I have created a build task in vs2012.
I ran it.
It complains that there are some missing references,
though I see them on my proj and they lead to relative path
(the folder that exists in the source control)
I have ereased the sln locally,
I did get latest from the source control and rebuilt it.
The references were missing. I have fixed it. Re-run the taks and again similar error.
How can it be if the sln builds successfuly on my machine and on a colleage clean machine?
If I had to take a guess, it would be one of the following:
The missing types are located in one or more assemblies that are either not checked into source control; or
Those assemblies are referenced via a path reference that isn't the right path in your source control.
Those assemblies aren't part of the normal project structure that would be pulled down by the build server.
Those assemblies are gac'd locally and you are referring to gac'd versions instead of the correct ones.
It's a web site project and someone on your team has those assemblies gac'd or installed in some other directory and they screw up the project every time they check it in. (common in web site projects, highly unusual in web application projects).
I have a weird situation with some code that I inherited at work. Their application is a multi-project solution, with several of the solutions being (code) pieces of the MS Enterprise Library (not sure which version).
They also have an existing C++ (unmanaged) application which has a bunch of DLLs. One of these DLLs is built in a separate solution, both in 64-bit and 32-bit flavours.
The main application has a reference to this DLL, and calls a couple of static functions (I can see intellisense, even). I can compile and build the main application EXEs, but when I run it, I get an exception that this DLL from the unmanaged code (lets call it CPlusPlusCode.dll cannot be found:
FileNotFound Exception was unhandled: Could not load file or assembly 'CPlusPlusCode.dll' or one of its dependencies. The specified module could not be found.
I'm quite stumped, because I can compile the code, see intellisense for the imported classes, and dig into the DLL in the object browser. I even made sure there's a copy in the \bin\Debug folder (although I don't see why that would make a difference). This is for a Windows Forms application.
Also, if it matters, I had some build issues related to x86 vs. x64 for different projects; I think (hope?) that this is not related to that, but I solved that by using the Configuration Manager to build everything as x64.
Check the GAC, and if necessary you might need to add it or register the DLL there.
I had this problem with a project, it all works ok from Visual Studio and most of my times running the project locally on my machine. But because of the unmanaged code I needed specifically allow the project to be executed with correct permission levels.
So have a look in the manifest file, that enough permissions etc exist.
I have recently refactored a lot of my applications existing code and I am now looking at tidying up the deployment side of things.
The existing installer application installs everything in the application folder (with the exclusion of a couple of config files which are located in a sub folder). However, I have multiple applications which all use some common assemblies and my goal is to relocate these particular assemblies to the "Common Files" folder in the program files directory.
NB: I have read a lot about the GAC but I have no experience with it and also read a few horror stories, so trying to get a simple solution for the time being.
I managed to get the assemblies installed into the Common Files folder, however, as a result (typical I.T.) I have broken my app! If I copy the assemblies back into the application folder it works fine so the problem is obviously to do with how my app is referencing the assemblies.
To get the installer to install the assemblies into the Common Files folder I just updated the Folder property of each assembly in the Detected Dependencies list. My thoughts were when I did that the installer would somehow update my application to tell it to look in that folder for them but that doens't appear to be the case.
What exactly am I doing wrong here?
There should be no requirements for assemblies to be in the GAC, unless the developer of an application/library designed it so. You have the choice to write you application so that most (if not all) referenced assemblies load from a specified (Common Files) location.
Here's an example architecture that implements the technologies described in the MSDN articles referenced at the bottom of this response.
Example: In an SOA application you might have a couple of different (Windows) services. Services could be load balanced across multiple servers. Within each server, services can be installed under a 'Services' directory. Services living in the 'Services' directory could share assemblies from a (Common Files) 'lib' directory:
\CompanyName
\Services
\Service1
\Service2
\Service3
\lib
Every actual service would derive from a Base Service class that would make use of an Assembly Utility. Your Assembly Utility could be configured to search for assemblies in a systematic way, allowing you to use shared/common assemblies. The neat thing is that your application could run with local assemblies (in local development) but use shared assemblies when deployed.
In my real world example, I had the luxury of having custom build and deployment scripts. Think of the different scenarios you can have deploying 1 of N services. Do you always update the (Common Files) 'lib' directory? Can a service run with local assemblies different than the 'lib' assemblies? Etc.
I hope this was helpful. If your issue is getting a third-party installer to deploy your application correctly, then disregard and name the installer. Otherwise, the given example/solution should help :o)
Read on the subject at MSDN:
Programming With Application Domains and Assemblies
Resolving Assembly Loads
ResolveEventHandler Delegate
PS: I've had challenges resolving assemblies for Microsoft's Unity framework.
If you wish to "reference" some assemblies from common folder, it is possible at development time. However when deploying every application has to have those individual assemblies installed with them.
If at run time, more than one of your applications are sharing some assemblies then "that common folder" is GAC.