none
vb.net embed/include dll possible or not? RRS feed

  • Question

  • wazup guys!

     

    In my applications I have too many dll's to run the applications. If I just have the .exe, the program will crach because it needs the dll's(in the same folder).

     

    ive tried refrence but if i set it to local copy true it will still have the dll and if I set it to false the program will crach

    So is it possible to embed some of the dll's into the .exe so the files in the folder isnt to many.

     

    Possible to embed dll's into .exe? And forgot to say some of the dll's am i not the owner of so im not able to just write a module.

     

    Thanks

     

    Simon

    EDIT* dont know why the text is to smal


    If you don´t Believe in it, Then it Doesn´t Exist!
    Tuesday, September 28, 2010 3:26 PM

Answers

  • You have several options:

    1. Live with it. Everyone else does, and finds it no real problem. In addition, you can easily see exactly what assemblies the program is using.

    2. Install the files in the GAC (Global assembly Cache). Possible, but can be a potential problem as it can bring back DLL ____. This isn't really an option used for single-use DLL files, and I would suspect is bad behaviour.

    3. use a manifest/config file which tells the application where to find the files (a sub-folder).

    Essentially, you need the files to be accessable by the application. Most users are not going to be browsing to the program folder, so having them there isn't an issue. Users who may do so, are more than likely not going to be put off by all those files. It does make me wonder, though, with so many files which (appear) to be not created by the OP, why 'hiding' these files is so important.


    Stephen J Whiteley
    • Marked as answer by Liliane Teng Tuesday, October 5, 2010 6:54 AM
    Tuesday, September 28, 2010 4:57 PM
    Moderator

All replies

  • Well typically you probably could just like you'd reference anything embedded in the .exe file changing the statement that says dll to target the one for the one in the resource.  If not, you can do a few things still.

    1.Register the files with windows, this then means any programs that need those .dll's will run without needing them in the same folder.  You could always un-register the .dll's after you close the program if this is a problem, but the method itself will work.

    2.Place the .dll's inside the folder at runtime before trying to use them, if you want to keep to a low number of .dll's while it is running, delete & place dll's to the folder as needed before & after using them.  This is generally a bit harder to code as usually it likes to error if all the used .dll's aren't there when it starts.

    • Proposed as answer by eng ahmed taha Wednesday, May 16, 2012 7:33 PM
    Tuesday, September 28, 2010 3:36 PM
  • I'm not sure what type of DLLs you are working with. If they are all .NET then I would simply copy them to the bin folder where your executable is located.

    If they are COM/ActiveX or installed in the GAC then you will need to provide a little more info.


    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, September 28, 2010 3:42 PM
  • I want to embed so its less files in the app folder.

     

    Some of the dll's is not created by microsoft which i downloaded.

     

    Helped?


    If you don´t Believe in it, Then it Doesn´t Exist!
    Tuesday, September 28, 2010 4:02 PM
  • I want to embed so its less files in the app folder.

     

    Some of the dll's is not created by microsoft which i downloaded.

    Helped?


    If you don´t Believe in it, Then it Doesn´t Exist!

    You have to consider these:
    -If you embed too much files with larger size, it will slow your executable to load

    - Only .net assembly (dll or exe) can be run from embedded resources

    kaymaf


    CODE CONVERTER SITE

    http://www.carlosag.net/Tools/CodeTranslator/.

    http://www.developerfusion.com/tools/convert/csharp-to-vb/.

    Tuesday, September 28, 2010 4:15 PM
  • I want to embed so its less files in the app folder.

     

    Some of the dll's is not created by microsoft which i downloaded.

     

    Helped?


    If you don´t Believe in it, Then it Doesn´t Exist!

    Even if you could embed them they would have to be extracted prior to execution of the application. There are third-party utilities that might be able to do this but nothing in Visual Studio.

    Paul ~~~~ Microsoft MVP (Visual Basic)
    Tuesday, September 28, 2010 4:21 PM
  • because i dont want like 20 dll's in the app folder. 1  exe would be nice
    If you don´t Believe in it, Then it Doesn´t Exist!
    Tuesday, September 28, 2010 4:26 PM
  • You have several options:

    1. Live with it. Everyone else does, and finds it no real problem. In addition, you can easily see exactly what assemblies the program is using.

    2. Install the files in the GAC (Global assembly Cache). Possible, but can be a potential problem as it can bring back DLL ____. This isn't really an option used for single-use DLL files, and I would suspect is bad behaviour.

    3. use a manifest/config file which tells the application where to find the files (a sub-folder).

    Essentially, you need the files to be accessable by the application. Most users are not going to be browsing to the program folder, so having them there isn't an issue. Users who may do so, are more than likely not going to be put off by all those files. It does make me wonder, though, with so many files which (appear) to be not created by the OP, why 'hiding' these files is so important.


    Stephen J Whiteley
    • Marked as answer by Liliane Teng Tuesday, October 5, 2010 6:54 AM
    Tuesday, September 28, 2010 4:57 PM
    Moderator