473,221 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 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 1489
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: nathan_kent_bullock | last post by:
Assume I am using a class Foo. I want to find out the modification time of the file that that class was defined in. How would I go about this? If I could find out the name of the file that Foo...
3
by: Dmitry Shaporenkov | last post by:
Hi all, I'd like to programmatically retrieve the directory of .NET framework binary tools (csc.exe, RegAsm.exe). What is the right way to do this? I can get InstallRoot via the Registry and...
2
by: Rob Cowie | last post by:
Hi, Given a string representing the path to a file, what is the best way to get at the filename? Does the OS module provide a function to parse the path? or is it acceptable to split the string...
7
by: Robert W. | last post by:
I think I'm going insane, but thought I'd check with you all first before I get myself commited! Here's a method I've built to retrieve an image: public static Image GetImage(string...
13
by: RHPT | last post by:
I am wanting to capture the XML posted by an InfoPath form with .NET, but I cannot figure out how to capture the XML stream sent back by the InfoPath form. With Classic ASP, I could just create an...
2
by: SLE | last post by:
Hi there, We have a class method which is invoked through Remoting/IIS. Within this class method, we need to get the physical path of the assembly (dll) in which the method is executing. we have...
4
by: John Dann | last post by:
Is there any method in the File, Directory, FileInfo, Path etc classes that makes it easy to retrieve the folder name of the immediate parent folder of a file? I can't see one, but maybe I've...
11
by: Nemisis | last post by:
Hi everyone, sorry if this post gets really long, i just wanna make sure i fully explain what i am trying to do. I am new to OOP and .net 2.0, so if this is obvious, i am sorry. I have wrote a...
5
by: Randy Smith | last post by:
Hi ALL, I wonder if anyone has been using n-tier to bind to a GridView control by using the ObjectDataSource. This is our first OOP web application, and we have no tables. Right now we are...
4
by: kaisersose1995 | last post by:
Hi, I'm trying to get Novell Netware information using vba into my access database and have no idea how to progress. Basically when i right click the properties on my computer the free space of a...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.