Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. DLL reference fails after first build

DLL reference fails after first build

Scheduled Pinned Locked Moved C#
helpquestion
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JacquesDP
    wrote on last edited by
    #1

    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!

    F J 2 Replies Last reply
    0
    • J JacquesDP

      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!

      F Offline
      F Offline
      fjdiewornncalwe
      wrote on last edited by
      #2

      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.

      J 1 Reply Last reply
      0
      • J JacquesDP

        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!

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        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.)

        J 2 Replies Last reply
        0
        • J jschell

          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.)

          J Offline
          J Offline
          JacquesDP
          wrote on last edited by
          #4

          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!

          J 1 Reply Last reply
          0
          • F fjdiewornncalwe

            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.

            J Offline
            J Offline
            JacquesDP
            wrote on last edited by
            #5

            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!

            1 Reply Last reply
            0
            • J JacquesDP

              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!

              J Offline
              J Offline
              JacquesDP
              wrote on last edited by
              #6

              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!

              1 Reply Last reply
              0
              • J jschell

                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.)

                J Offline
                J Offline
                JacquesDP
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups