Command Line Compile + Subdirectory DLL Not Working?

Discussion in 'C#' started by imported_will, Oct 18, 2008.

  1. imported_will

    imported_will New Member

    Joined:
    Oct 18, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Ok , heres the thing. I have a project im workin on, and i have my exe , in a directory, with a subdirectory named DLL and inside that my dll.

    I was sure that


    csc /t:winexe /lib:DLL /r:uiobj.dll msf_exe.cs

    also have tried

    csc /t:winexe /lib:.\DLL /r:uiobj.dll msf_exe.cs


    is the compiler command i would use to create my exe, set up a DLL subdirectory and reference the dll inside it...

    But alas when i run the exe and JiT Debugger error somes up saying System.IO.FileNotFound exception.... even though the command compiler does not have any error compiling the code.

    It doesnt matter what i do , if i dont have my dll inside the folder with the exe it wont work. I can even add my dll to the GAC with gacutil.exe and that works fine. I just cant access my private dll's inside my subdirectory. Could it be that my environment vars are set wrong , or something else. i was sure that /:lib set a directory reference , but its just not working for me /cry :(

    Any help or ideas would be great, thanks you in advance!

    PS : i dunno what i need to do to stop that stupid green smile face , its supposed to be a d.
     
  2. imported_will

    imported_will New Member

    Joined:
    Oct 18, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Damn , im went two days fighting with this, and i have the answer to my question. I have never come across the need to use a Config file before , but it is the solution to all problems. If you are like me and want your project to maintain some form of organization, you will probably not want oodles of dll's inside your main app directory. This is easily achieved with a config file. You can create your application config file with notepad. EG:

    Assuming that you wish to use a directory structure siliar to this :

    Application Folder --> app.exe
    Application Folder --> app.exe.config
    Application Folder -->Folder DLL
    Folder DLL --> your_dll1.dll
    Folder DLL --> your_dll2.dll
    Folder DLL --> your_dll3.dll


    Open up notepad and and add this ....

    <configuration>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <probing privatePath="DLL"/>
    </assemblyBinding>
    </runtime>
    </configuration>


    Now save it as UTF-8 and name it as seen here ...
    <application-name.exe.config where <application-name> is the name of your application.

    Until next time , bye.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice