473,463 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

VB.NET - Set path for DLLs

Max
Have a little problem here; I have a solution with two projects. One of
the projects is an executable file and the other is a dll. The dll is
just basically one class, so in the exe I've added that project as a
reference and am able to use all the contents by creating a new object
(Dim myclass as new dll_file.myclass). That works fine, when I build the
solution it creates those two files and everything works, however, what
I need to do is have the dll in a different folder then the executable.
How do I tell the exe file to look for this dll in the \bin\ folder for
example? Right now I've specified the target paths so it automatically
puts the files where they need to be, but when I launch the program it
comes up with an error that basically states file not found.
Nov 20 '05 #1
6 14980
"Max" <ma*****@yahoo.com> schrieb
Have a little problem here; I have a solution with two projects. One
of the projects is an executable file and the other is a dll. The
dll is just basically one class, so in the exe I've added that
project as a reference and am able to use all the contents by
creating a new object (Dim myclass as new dll_file.myclass). That
works fine, when I build the solution it creates those two files and
everything works, however, what I need to do is have the dll in a
different folder then the executable. How do I tell the exe file to
look for this dll in the \bin\ folder for example? Right now I've
specified the target paths so it automatically puts the files where
they need to be, but when I launch the program it comes up with an
error that basically states file not found.


Maybe this helps?

http://msdn.microsoft.com/library/en...assemblies.asp
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Max
Armin Zingler wrote:
"Max" <ma*****@yahoo.com> schrieb

Have a little problem here; I have a solution with two projects. One
of the projects is an executable file and the other is a dll. The
dll is just basically one class, so in the exe I've added that
project as a reference and am able to use all the contents by
creating a new object (Dim myclass as new dll_file.myclass). That
works fine, when I build the solution it creates those two files and
everything works, however, what I need to do is have the dll in a
different folder then the executable. How do I tell the exe file to
look for this dll in the \bin\ folder for example? Right now I've
specified the target paths so it automatically puts the files where
they need to be, but when I launch the program it comes up with an
error that basically states file not found.


Maybe this helps?

http://msdn.microsoft.com/library/en...assemblies.asp


Could you give me some code examples?
Nov 20 '05 #3
"Max" <ma*****@yahoo.com> schrieb


Maybe this helps?


http://msdn.microsoft.com/library/en...runtimelocates

assemblies.asp



Could you give me some code examples?


No.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
Max,
In addition to Armin's comments.

You can use either AppDomain.AppendPrivatePath or the
runtime/assemblyBinding/probing/privatePath app.config setting.

The problem with AppDomain.AppendPrivatePath, is it gets done after the
startup class & method starts, so if the startup class & method refers to
anything in the class assemblies you get JIT errors...

Public Sub Main()
AppDomain.CurrentDomain.AppendPRivatePath("bin")
...
End Sub

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

Hope this helps
Jay

"Max" <ma*****@yahoo.com> wrote in message
news:6u********************@comcast.com...
Have a little problem here; I have a solution with two projects. One of
the projects is an executable file and the other is a dll. The dll is
just basically one class, so in the exe I've added that project as a
reference and am able to use all the contents by creating a new object
(Dim myclass as new dll_file.myclass). That works fine, when I build the
solution it creates those two files and everything works, however, what
I need to do is have the dll in a different folder then the executable.
How do I tell the exe file to look for this dll in the \bin\ folder for
example? Right now I've specified the target paths so it automatically
puts the files where they need to be, but when I launch the program it
comes up with an error that basically states file not found.

Nov 20 '05 #5
Max
Thanks for that suggestion, however I'm not exactly sure how to use that
<configuration> stuff?
I tried AppDomain way, but still doesn't seem to find the dll:

Public Sub Main()
AppDomain.CurrentDomain.AppendPrivatePath("bin")

Dim Shell As New Shell_dll.Shell_Main
Shell.TestSub()
End Sub

Basically have Shell_dll namespace and a class Shell_Main in the
Shell.dll file that's in \bin directory. TestSub should simply give me a
msgbox to let me know that it works.
Jay B. Harlow [MVP - Outlook] wrote:
Max,
In addition to Armin's comments.

You can use either AppDomain.AppendPrivatePath or the
runtime/assemblyBinding/probing/privatePath app.config setting.

The problem with AppDomain.AppendPrivatePath, is it gets done after the
startup class & method starts, so if the startup class & method refers to
anything in the class assemblies you get JIT errors...

Public Sub Main()
AppDomain.CurrentDomain.AppendPRivatePath("bin")
...
End Sub

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

Hope this helps
Jay

"Max" <ma*****@yahoo.com> wrote in message
news:6u********************@comcast.com...

Have a little problem here; I have a solution with two projects. One of
the projects is an executable file and the other is a dll. The dll is
just basically one class, so in the exe I've added that project as a
reference and am able to use all the contents by creating a new object
(Dim myclass as new dll_file.myclass). That works fine, when I build the
solution it creates those two files and everything works, however, what
I need to do is have the dll in a different folder then the executable.
How do I tell the exe file to look for this dll in the \bin\ folder for
example? Right now I've specified the target paths so it automatically
puts the files where they need to be, but when I launch the program it
comes up with an error that basically states file not found.


Nov 20 '05 #6
Max,
To use the <configuration> stuff you need to add an app.config to your EXE
project, the "best" way to do this is to use "Project - Add New Item -
Application Configuration File". This will create an empty app.config file
in the root of your project.

After you do this, when you build your app a file will be created in your
bin directory called YourProject.exe.config (that matches your
YouProject.exe).

Hope this helps
Jay

"Max" <ma*****@yahoo.com> wrote in message
news:tr********************@comcast.com...
Thanks for that suggestion, however I'm not exactly sure how to use that
<configuration> stuff?
I tried AppDomain way, but still doesn't seem to find the dll:

Public Sub Main()
AppDomain.CurrentDomain.AppendPrivatePath("bin")

Dim Shell As New Shell_dll.Shell_Main
Shell.TestSub()
End Sub

Basically have Shell_dll namespace and a class Shell_Main in the
Shell.dll file that's in \bin directory. TestSub should simply give me a
msgbox to let me know that it works.
Jay B. Harlow [MVP - Outlook] wrote:
Max,
In addition to Armin's comments.

You can use either AppDomain.AppendPrivatePath or the
runtime/assemblyBinding/probing/privatePath app.config setting.

The problem with AppDomain.AppendPrivatePath, is it gets done after the
startup class & method starts, so if the startup class & method refers to
anything in the class assemblies you get JIT errors...

Public Sub Main()
AppDomain.CurrentDomain.AppendPRivatePath("bin")
...
End Sub

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

Hope this helps
Jay

"Max" <ma*****@yahoo.com> wrote in message
news:6u********************@comcast.com...

Have a little problem here; I have a solution with two projects. One of
the projects is an executable file and the other is a dll. The dll is
just basically one class, so in the exe I've added that project as a
reference and am able to use all the contents by creating a new object
(Dim myclass as new dll_file.myclass). That works fine, when I build the
solution it creates those two files and everything works, however, what
I need to do is have the dll in a different folder then the executable.
How do I tell the exe file to look for this dll in the \bin\ folder for
example? Right now I've specified the target paths so it automatically
puts the files where they need to be, but when I launch the program it
comes up with an error that basically states file not found.


Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: ketulp_baroda | last post by:
Hi I am having a problem in appending to sys.path I am doing it this way: >>> sys.path >>> sys.path.append(r'D:\Python23\Lib\site-packages\code') >>> sys.path But when I close the shell...
9
by: Grant Edwards | last post by:
I have several python apps (some wxPython, some plain text-mode stuff) that I distribute internally for installation on Win32 machines. They're bundled/installed using py2exe and inno setup. I...
6
by: Laszlo Zsolt Nagy | last post by:
Sorry, I realized that the import zlib was not executed from my (working) service. So here is the question: why can't I use zlib from a win32 service? Is there any way to make it working? ...
4
by: Matt Sawyer | last post by:
I am attempting to use an API (CxApiOem.dll) that has a large number of defines and complicated structs. It's just too much hassle to attempt to use DLLImport to make the desired API calls. ...
1
by: iana_kosio | last post by:
Hi, I was wondering if I can make an aspx file use the PATH variable to locate dlls that it needs. Currently, it looks as though that the aspx page looks for binaries in a bin folder that is...
2
by: njr | last post by:
Having copied a number of folders from my development PC (XP) to a development server (W2003) and installed them under wwwroot (and created applications in IIS) I have problems when I include the...
0
by: Reini | last post by:
We are developing an Asp.Net 2.0 application (Web Administration) for the IIS 5.0 to 6.0 and the W2K to W2K3 operating system. The application consists of several layers. One layer is a .Net 2.0...
0
by: Chris Ashley | last post by:
Does the ASP.Net worker process not look in the System PATH environment variable for DLLs (unmanaged, non-COM)? If I place all the DLLs my app needs in a directory in the System PATH I get 'The...
7
by: siggi | last post by:
Hi all, when I do >>>sys.path in IDLE (winXP), i get a horrendously long list of paths, paths I may have used during a lot of trials and errors. How can I clean up sys.path? I mean, trim it of...
6
by: HONOREDANCESTOR | last post by:
Suppose I have a dll which might be installed in the directory c: \MyClass\. I want to be able to find the path of this dll from within the dll. In other words, I want a function that can return...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.