Hey guys!
I'm making a simple app that will need some DLLs that I'm using, but I don't want them to be in the same place as the main exe.

How can I make my app to load these dlls from a specified folder, like %mainappfolder%\files\dlls ?

Thanks!

Hey!
I've read it, also I've read a bit on the VS help, but it didn't get clear to me. How can I implement it into my app?

How can I pass to it to look for the dlls into files\dlls folder instead the exe folder?

In the Build part of the project properties you can tell the system to reference your dlls, whether to include or exclude during build, where to place them after build, and make a installer that places them there. look up the exact directions in the studio help file, or on the MSDN page. its all spelled out.

Right, I looked at it and there isn't any Build tab. I've also looked at the help, and nothing clear on vb.net.

Tried myself, no luck too. Maybe I'm missing something,

Look at this article for instructions on creating an installer.

Look at this article to get a great tutorial on how to make an installer package with files

I don't want to create a installer right now.
I need that my app, even on development stage, load files from a folder that I specify, don't matter what files I need (except from the framework ones).

The point is that if you use references from the tools menu during development, you can use any dll file system that you need. Point the reference to your DLL and that should work.

Even references a C# solution, have you read this?

Hope this helps

Nothing helped. I tried the installer, but app still crashing when I run it with my dlls not being in the same folder.

Did you tryed to change the search path inthe destination machine to point also to the directory where those dll are placed? (CMD -> SET)

Did you tryed to set the installer to register the DLLs in the GAC?

Hope this helps

There is no such a sense on installing a file since it will run from a disk. that's why I need it to look for the files in the folder I say so.

Also, ILmerge didn't worked. Appears that the files I'm using are not compatible.

This one seems to don't have solution.
Everything I try doesn't work.

See if this helps.

MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath.
        MsgBox(IO.File.ReadAllText(TextBox1.Text & "test.txt")) '// for testing.

When Debugging your project, it will use the bin\Debug folder. In this case, you will need to add your 2 folders to that directory.

After publishing your application and having it install, make sure that those 2 folders are in the same folder as your .exe.

Did you tryed some thing like this

Maybe you can explore this way.

Hope this helps

MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath.
        MsgBox(IO.File.ReadAllText(TextBox1.Text & "test.txt")) '// for testing.

Should actually be:

MsgBox(Application.StartupPath & "\files\dlls\") '// use Application.StartupPath.
        MsgBox(IO.File.ReadAllText(Application.StartupPath & "\files\dlls\" & "test.txt")) '// for testing.

My apologies for the confusion, if any. I was using a TextBox1 for testing purposes.
The "test.txt" is a file located in the "dlls" folder.

This will work for image files and all, which is part of what I need.

I also need that the app look for my needed dlls inside some folder, dlls that will compose the main interface, like custom controls.

There is someway to to it?

Using the CMD command SET (see this) to set the PATH variable (see my previous post)

This environment variable defines the paths to be searched for executables and dlls not found on the startup folder and not in the GAC as stated here

This can also be done programatically using the GetEnvironmentVariable and the SetEnvironmentVariable from the System.Environment namespace in .NET.

Also there is a way using the API as defined here

Hope this helps

Appears that absolutely nothing works, or at least nothing that I know is working. I've read all links and all statements posted here, and it still doesn't get clear on my mind.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.