DLL reference fails after first build
-
Hi Guys, I'm facing a very weird problem, I'm referencing a third party dll in a windows service I'm developing. When I add the reference, then include it in the using list and work with the dll everything is fine, intelesense picks up all the methods in the dll etc, but the moment that I build my project it gives exceptions on the dll, intelesense no longer recognizes it or the methods I used. The excpetion I receive after the build is.. The type or namespace name 'XXX' could not be found (are you missing a using directive or an assembly reference?) Any ideas or help would really be appreciated. Thanks
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
Hi Guys, I'm facing a very weird problem, I'm referencing a third party dll in a windows service I'm developing. When I add the reference, then include it in the using list and work with the dll everything is fine, intelesense picks up all the methods in the dll etc, but the moment that I build my project it gives exceptions on the dll, intelesense no longer recognizes it or the methods I used. The excpetion I receive after the build is.. The type or namespace name 'XXX' could not be found (are you missing a using directive or an assembly reference?) Any ideas or help would really be appreciated. Thanks
No matter how long he who laughs last laughs, he who laughs first has a head start!
I'm not sure if this will solve the problem, but one thing to check is that the dll gets copied to the output directory if it isn't in the GAC
I wasn't, now I am, then I won't be anymore.
-
Hi Guys, I'm facing a very weird problem, I'm referencing a third party dll in a windows service I'm developing. When I add the reference, then include it in the using list and work with the dll everything is fine, intelesense picks up all the methods in the dll etc, but the moment that I build my project it gives exceptions on the dll, intelesense no longer recognizes it or the methods I used. The excpetion I receive after the build is.. The type or namespace name 'XXX' could not be found (are you missing a using directive or an assembly reference?) Any ideas or help would really be appreciated. Thanks
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
In my experience the only way that can happen is if the dll is getting overwritten. Since it is a 3rd party dll that would suggest that you are copying a new version in. Or even building to the wrong name perhaps (your library has the same name.)
Thanks for the reply. I should clarify that by third party I mean that; the dll is a class library (developed by different team) residing under the same main solution as what the windows service (being developed by myself) is. So when I reference it I add the reference to the class library project under the solution and not the compiled dll as such, with the understanding that in doing so that when the solution builds that class library builds and the dll is supposed to be built to the bin directory of my service, which is currently not happening and I suspect that to be the problem. But the strange thing is that if I just add the reference to the library, intelesense picks up the namespace of the library, I'm able to instantiate methods under the library etc, but as soon as I run that first build it no longer recognizes the namespace or any of the method instantiation. I'll try changing the reference from the project to the compiled dll directly and hopefully that will help. Thanks for the help.
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
I'm not sure if this will solve the problem, but one thing to check is that the dll gets copied to the output directory if it isn't in the GAC
I wasn't, now I am, then I won't be anymore.
It does not appear that the dll is being copied to the bin directory on the build. You can have a look at my message below for more detailed explanation of the setup. Thanks for the reply.
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
Thanks for the reply. I should clarify that by third party I mean that; the dll is a class library (developed by different team) residing under the same main solution as what the windows service (being developed by myself) is. So when I reference it I add the reference to the class library project under the solution and not the compiled dll as such, with the understanding that in doing so that when the solution builds that class library builds and the dll is supposed to be built to the bin directory of my service, which is currently not happening and I suspect that to be the problem. But the strange thing is that if I just add the reference to the library, intelesense picks up the namespace of the library, I'm able to instantiate methods under the library etc, but as soon as I run that first build it no longer recognizes the namespace or any of the method instantiation. I'll try changing the reference from the project to the compiled dll directly and hopefully that will help. Thanks for the help.
No matter how long he who laughs last laughs, he who laughs first has a head start!
JacquesDP wrote:
I'll try changing the reference from the project to the compiled dll directly and hopefully that will help.
Scratch that one, tried it with the exact same result as referencing the project, works until the first build.
No matter how long he who laughs last laughs, he who laughs first has a head start!
-
In my experience the only way that can happen is if the dll is getting overwritten. Since it is a 3rd party dll that would suggest that you are copying a new version in. Or even building to the wrong name perhaps (your library has the same name.)
Think I might have found the problem, I never read the warnings on the build failure, and saw the following warning being displayed. The referenced assembly "XXX.dll" could not be resolved because it has a dependency on "System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project. CallCentreMgrNS Thanks. ----MODIFIED----- Changed the targeted framework of my service from .NET Framework 4.0 Client Profile to .NET Framework 4.0 and no the project builds successfully
No matter how long he who laughs last laughs, he who laughs first has a head start!
modified on Tuesday, January 4, 2011 2:38 AM