Welcome to APLNext Sign in | Join | Help
in
Community Website
Blogs Forums

Question + Answer: refbyfile vs using MSVS Solution Explorer to add a reference

Last post 01-25-2007, 5:47 PM by joe.blaze. 0 replies.
Sort Posts: Previous
  • Question + Answer: refbyfile vs using MSVS Solution Explorer to add a reference

     01-25-2007, 5:47 PM

    Recently I was constructing a VisualAPL Windows Forms Project (.exe) and I put a refbyfile @"path...\...dll" and a using statement for a class in that dll in the using directives region of the form1.apl file. When I tried to debug, I received the MSVS error message "... cannot load ...dll...".

    I carefully checked the path and name of the dll, the case of the using statement argument and the existence of the .dll file in the path specified. All were ok.

    Somewhat annoyed, I removed the refbyfile, but left the using statement and then went to the Solution Explorer for this .exe project to manually add the reference to this dll by browsing. Now the .exe project debugged fine. Why?

    Fred came to the rescue, after checking with Jairo of course, noting:

    (a)   When in debug mode all referenced .dlls must be present in the .exe project's directory and this is a security feature of MSVS. The production build of the .exe project may not require this, depending on the 'local copy' property of the reference.

    (b)   When a reference is added wiith the Solution Explorer, MSVS copies the referenced .dll file to the .exe project's subdirectory, thus satisfying (a).

    (c)   When a refbyfile @"..." is included in the using directives region of the .exe project code, the referenced .dll is not copied by MSVS to the .exe project's subdirectory, so unless the programmer does this copying manually, the MSVS error message "... cannot load ...dll..." warns the programmer of his/her error.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems