Can't Add Reference to DLL RRS feed

  • Question

  • I created a class library dll in VS 2005. I can add a reference to the dll in other VS 2005 projects. I can also use the dll from VB6 (I added all the correct interop stuff).

    However, when I load up a VS2003 project and try to add a reference to the DLL, I get an error that tells me that the dll is not a valid assembly or COM component.

    Is it not possible to use .Net 2.0 DLLs in .Net 1.x?



    Monday, February 20, 2006 4:02 PM


  • You might be able to get it to work outside VS through the command line but VS 2003 doesn't support v2.0 of .NET.  From what I have heard from MS developers VS is tightly coupled with the version of .NET and therefore won't work with other versions.  That is part of the reason why VS 2005 doesn't support v1.x.

    Nevertheless even if you got it to compile I doubt it would run.  The problem is that there can be only one version of the runtime loaded (AFAIK).  The executable will determine the version to load (based on either its build settings or configuration file).  Therefore if the executable loads the v1.1 runtime then the v2.0 binaries won't run.  You could force the executable to load the v2.0 runtime but then it begs the question of why you don't just recompile your app under v2.0.

    In summary you should use v2.0 binaries with v2.0 apps and v1.x binaries with v1.x apps.  V1.x binaries will run under the v2.0 runtime (for the most part) but you'll need to be running a v2.x app first which mandates using VS 2005 instead of VS 2003.

    Michael Taylor - 2/21/06

    Tuesday, February 21, 2006 12:05 PM