471,348 Members | 1,134 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,348 software developers and data experts.

Retrieving path of a DLL

I can retrieve the path of a Windows form using the Application object.
However, if I write a class which will be compiled into a DLL, would it
be possible to retrieve the DLL path (without passing the Application
object to the class) ???

Dec 22 '05 #1
4 1417
H:

Assembly.GetExecutingAssembly().Location

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Huy Hoang" <dr*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I can retrieve the path of a Windows form using the Application object.
However, if I write a class which will be compiled into a DLL, would it
be possible to retrieve the DLL path (without passing the Application
object to the class) ???

Dec 22 '05 #2
Yeah, I saw there was a post about the same topic, a few posts earlier.
So I deleted my starting post, but somehow you managed to reply anyway.

Dec 22 '05 #3
Hi,

Well I did the other answer too :)

"Huy Hoang" <dr*****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Yeah, I saw there was a post about the same topic, a few posts earlier.
So I deleted my starting post, but somehow you managed to reply anyway.

Dec 22 '05 #4
Huy,

You can do this in a many different ways, but the goal is to get reference
to the assembly and check out its Location property.

For example:
1. From code in the DLL you can do
Assembly.GetExecutingAssembly().Location

2. If Foo is a class decalred in the DLL
typeof(Foo).Assembly.Location.
or
using Assembly's static method GetAssembly()
or
using object of a type decalred in the DLL
obj.GetType().Assembly.Location

3. Using the domain AppDomain.CurrentDomain.GetAssemblies() and then finding
out your assembly and check its Location property.

I believe there are more variations on this.
--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Huy Hoang" <dr*****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I can retrieve the path of a Windows form using the Application object.
However, if I write a class which will be compiled into a DLL, would it
be possible to retrieve the DLL path (without passing the Application
object to the class) ???

Dec 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by nathan_kent_bullock | last post: by
3 posts views Thread by Dmitry Shaporenkov | last post: by
2 posts views Thread by Rob Cowie | last post: by
7 posts views Thread by Robert W. | last post: by
13 posts views Thread by RHPT | last post: by
4 posts views Thread by John Dann | last post: by
11 posts views Thread by Nemisis | last post: by
5 posts views Thread by Randy Smith | last post: by
1 post views Thread by Ronak mishra | last post: by

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.