By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,033 Members | 1,285 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,033 IT Pros & Developers. It's quick & easy.

Assembly location

P: n/a
Hello,

I have an .exe that uses a .dll. I want to put the .dll file into a
directory "\bin". How do I tell the .exe to search in "\bin" for the dll?

Thanks.
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Qwert" <no**@nosp.com> schrieb

I have an .exe that uses a .dll. I want to put the .dll file into a
directory "\bin". How do I tell the .exe to search in "\bin" for the
dll?


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

Nov 21 '05 #2

P: n/a
"Qwert" <no**@nosp.com> wrote in message
news:2v********************@casema.nl...
: Hello,
:
: I have an .exe that uses a .dll. I want to put the .dll file into a
: directory "\bin". How do I tell the .exe to search in "\bin" for the
: dll?
:
: Thanks.
You'll need to add this to your application configuration file. This
file must be named "YourExecutableFileName.exe.config". In otherwords,
if your executable is named tmp.exe, then the config file must be named
tmp.exe.config. Also, it must be in the same folder as your executable.
If you don't have an application configuration file, you'll need to add
one. If you are using Visual Studio, open your project then add a new
file to it (Select "Add New Item ..." from the "File" menu, expand the
"Local Project Items" item and click on "Utility"; on the right side,
click on the "Application Configuration File" icon an save it). Visual
Studio names this file "app.config" and renames it to the correct value
when you build your app.
You can also create this file yourself. Simply create a file with the
correct name and edit it in your favorite text editor.
Regardless of how you add this file, make sure the following entry is in
it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

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

</configuration>
Here is an example:
================================================== =

'dll.vb:
Option Strict On

Namespace MyDLLSample
Public Class DLLSample
Public Function DoSomething() As String
Return "Response from DLLSample -> DoSomething()"
End Function
End Class
End Namespace
================================================== =

'tmp.vb:
Option Strict On

Imports System
Imports MyDLLSample

Public Class [class]
Public Shared Sub Main()
Dim ds As New DLLSample
Console.WriteLine(ds.DoSomething)
End Sub
End Class

================================================== =

tmp.exe.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin"/>
</assemblyBinding>
</runtime>
</configuration>
================================================== =

compiler command lines:

vbc /t:library /out:bin\dllsample.dll dll.vb
vbc /out:tmp.exe /r:bin\dllsample.dll tmp.vb
That should do it.
Ralf
Nov 21 '05 #3

P: n/a
Thanks both. It works.
<probing privatePath="bin"/> did the trick.
"_AnonCoward" <ab*@xyz.com> schreef in bericht
news:e7********************@twister.southeast.rr.c om...
"Qwert" <no**@nosp.com> wrote in message
news:2v********************@casema.nl...
: Hello,
:
: I have an .exe that uses a .dll. I want to put the .dll file into a
: directory "\bin". How do I tell the .exe to search in "\bin" for the
: dll?
:
: Thanks.
You'll need to add this to your application configuration file. This
file must be named "YourExecutableFileName.exe.config". In otherwords,
if your executable is named tmp.exe, then the config file must be named
tmp.exe.config. Also, it must be in the same folder as your executable.
If you don't have an application configuration file, you'll need to add
one. If you are using Visual Studio, open your project then add a new
file to it (Select "Add New Item ..." from the "File" menu, expand the
"Local Project Items" item and click on "Utility"; on the right side,
click on the "Application Configuration File" icon an save it). Visual
Studio names this file "app.config" and renames it to the correct value
when you build your app.
You can also create this file yourself. Simply create a file with the
correct name and edit it in your favorite text editor.
Regardless of how you add this file, make sure the following entry is in
it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

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

</configuration>
Here is an example:
================================================== =

'dll.vb:
Option Strict On

Namespace MyDLLSample
Public Class DLLSample
Public Function DoSomething() As String
Return "Response from DLLSample -> DoSomething()"
End Function
End Class
End Namespace
================================================== =

'tmp.vb:
Option Strict On

Imports System
Imports MyDLLSample

Public Class [class]
Public Shared Sub Main()
Dim ds As New DLLSample
Console.WriteLine(ds.DoSomething)
End Sub
End Class

================================================== =

tmp.exe.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin"/>
</assemblyBinding>
</runtime>
</configuration>
================================================== =

compiler command lines:

vbc /t:library /out:bin\dllsample.dll dll.vb
vbc /out:tmp.exe /r:bin\dllsample.dll tmp.vb
That should do it.
Ralf

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.