none
Reference : embed Interop types / local copy RRS feed

  • Question

  • Hi, 

    I'm currently facing a problem with Visual Studio.

    In my project, I'm using a .dll file which I added as a reference. I have no problem for using it in debugging, but of course, I can't run my generated .exe file in another folder (for example the desktop folder). I need to copy the .dll file in the same folder, but it's not my point. 

    I actually would like to know if there is a way to embed the .dll file in my project or in the generated .exe file. And if not, what is the correct way to proceed in the use of .dll copies.

    I've tried to set the Embed Interop Types property of my reference to True, but it's just not working for some types I'm using.

    Thanks.


    Nimzozo, from France.


    • Edited by Nimzozo Sunday, October 13, 2013 4:40 PM
    Sunday, October 13, 2013 4:36 PM

Answers

  • Depends. If the DLL is purely managed you can embed it via ilmerge. If it is not then you are out of luck. You can ask author to give you source code.

    embed Interop types is for a COM reference which means you still need the COM server shipped with your application. embedding interop types would only eliminate the interop dll dependency.



    Visual C++ MVP

    Sunday, October 13, 2013 4:58 PM
  • I think there is a problem with dll dependencies.  Normally when you have tow projects you don't copy the dll into the local project.  Instead you browse for the dll in its original folder.  I would put the dll back in its original folder.  Make sure you rebuild the entire project.  I would delete your entire bin folder which will force the entire project to get rebuilt.  there seems to be a problem with the dependencies inside your project.

    There are two .exe files in a project.  One in the debug folder and one in the release folder.  the one in the debug folder get recompiled when you to a build.   Te one in the relese folder get rebuilt when you do a rebuild.  This may vary slightly between dirfferent versions of VS.  there are some known problems in some version of VS (usally in VS 2012 & 2013) that need to be fixed.  I suspect this problem has to do with one of these versions.  Maybe you should go to Windows update and make sure you have all the latest upgrade for Net library and VS.


    jdweng

    Sunday, October 13, 2013 9:25 PM

All replies

  • Depends. If the DLL is purely managed you can embed it via ilmerge. If it is not then you are out of luck. You can ask author to give you source code.

    embed Interop types is for a COM reference which means you still need the COM server shipped with your application. embedding interop types would only eliminate the interop dll dependency.



    Visual C++ MVP

    Sunday, October 13, 2013 4:58 PM
  • Thanks for enlightning me.

    So probably the solution for me is to use a local copy of the reference, if I can't get source code ?


    Nimzozo, from France.

    Sunday, October 13, 2013 5:11 PM
  • Yes that is the easiest solution.

    Why you have the requirement to begin with? Your program has a dependency on .net, it is unlikely you can get away without shipping .net framework, so adding another dll to the setup should be trivial.



    Visual C++ MVP

    Sunday, October 13, 2013 5:23 PM
  • You are right. I'm sorry if my question seemed trivial, but I'm totally in lack of experience in application deployment. Thank you anyway for answering me.

    Nimzozo, from France.

    Sunday, October 13, 2013 5:50 PM
  • Actually, when I want to test the application, I like to have only one file to launch.

    Nimzozo, from France.

    Sunday, October 13, 2013 6:57 PM
  • I think there is a problem with dll dependencies.  Normally when you have tow projects you don't copy the dll into the local project.  Instead you browse for the dll in its original folder.  I would put the dll back in its original folder.  Make sure you rebuild the entire project.  I would delete your entire bin folder which will force the entire project to get rebuilt.  there seems to be a problem with the dependencies inside your project.

    There are two .exe files in a project.  One in the debug folder and one in the release folder.  the one in the debug folder get recompiled when you to a build.   Te one in the relese folder get rebuilt when you do a rebuild.  This may vary slightly between dirfferent versions of VS.  there are some known problems in some version of VS (usally in VS 2012 & 2013) that need to be fixed.  I suspect this problem has to do with one of these versions.  Maybe you should go to Windows update and make sure you have all the latest upgrade for Net library and VS.


    jdweng

    Sunday, October 13, 2013 9:25 PM