473,574 Members | 3,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dll Path

Tim
Hi,

How can I find the path in which a dll is executing from? I do not want
the Exe path. Is there a way to get the dll path in C# - something like the
output of GetModuleFileNa me API ?
Dec 21 '05 #1
4 3774
Hi,

Arey ou talking about a .net assembly ?
If so you can use Assembly.Locati on , all you need to do is get a reference
to the assembly you are interested in.

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

"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:58******** *************** ***********@mic rosoft.com...
Hi,

How can I find the path in which a dll is executing from? I do not want
the Exe path. Is there a way to get the dll path in C# - something like
the
output of GetModuleFileNa me API ?

Dec 21 '05 #2
Tim
Thank you, Ignacio.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Arey ou talking about a .net assembly ?
If so you can use Assembly.Locati on , all you need to do is get a reference
to the assembly you are interested in.

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

"Tim" <Ti*@discussion s.microsoft.com > wrote in message
news:58******** *************** ***********@mic rosoft.com...
Hi,

How can I find the path in which a dll is executing from? I do not want
the Exe path. Is there a way to get the dll path in C# - something like
the
output of GetModuleFileNa me API ?


Dec 22 '05 #3
Hi,

I'm also trying to get the path a DLL is located.

I am using:
string path = System.Reflecti on.Assembly.Get Assembly(this.G etType()).Locat ion;

This give path a value of:
C:\Program Files\Microsoft Dynamics\GP\Add Ins\Workflow.dl l

Which is great, but I don't want the "Workflow.d ll" part of the path.

Is there a different call I can use to bring back just:
C:\Program Files\Microsoft Dynamics\GP\Add Ins\

Or is there a way I can strip out the "Workflow.d ll" part of the path
without hard-coding the DLL name.

Thanks,
Ed
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Arey ou talking about a .net assembly ?
If so you can use Assembly.Locati on , all you need to do is get a reference
to the assembly you are interested in.

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

"Tim" <Ti*@discussion s.microsoft.com wrote in message
news:58******** *************** ***********@mic rosoft.com...
Hi,

How can I find the path in which a dll is executing from? I do not want
the Exe path. Is there a way to get the dll path in C# - something like
the
output of GetModuleFileNa me API ?


Feb 27 '07 #4
Once you get the path, invoke:

string yourDirectory = Path.GetDirecto ryName(yourPath AsString);
"eieed" <ei***@discussi ons.microsoft.c omwrote in message
news:3E******** *************** ***********@mic rosoft.com...
Hi,

I'm also trying to get the path a DLL is located.

I am using:
string path =
System.Reflecti on.Assembly.Get Assembly(this.G etType()).Locat ion;

This give path a value of:
C:\Program Files\Microsoft Dynamics\GP\Add Ins\Workflow.dl l

Which is great, but I don't want the "Workflow.d ll" part of the path.

Is there a different call I can use to bring back just:
C:\Program Files\Microsoft Dynamics\GP\Add Ins\

Or is there a way I can strip out the "Workflow.d ll" part of the path
without hard-coding the DLL name.

Thanks,
Ed
"Ignacio Machin ( .NET/ C# MVP )" wrote:
>Hi,

Arey ou talking about a .net assembly ?
If so you can use Assembly.Locati on , all you need to do is get a
reference
to the assembly you are interested in.

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

"Tim" <Ti*@discussion s.microsoft.com wrote in message
news:58******* *************** ************@mi crosoft.com...
Hi,

How can I find the path in which a dll is executing from? I do not
want
the Exe path. Is there a way to get the dll path in C# - something like
the
output of GetModuleFileNa me API ?



Feb 27 '07 #5

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

Similar topics

31
3886
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff in the os module got objectified properly (or at least with some semblance of OO propriety!) In the issues section:
9
3592
by: Bengt dePaulis | last post by:
I have a local directory that I want to include in my sys.path How to save it permanently? Regards /Bengt
70
4054
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the Python standard library, and Reinhold Birkenfeld started a discussion on it in python-dev...
34
3240
by: Reinhold Birkenfeld | last post by:
Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. It still can be found in CVS: /python/nondist/sandbox/path/{path.py,test_path.py} One thing is still different, though: a Path instance won't compare to a regular string.
2
23370
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 using '/' as delimiters and get the last 'word'. The reason I'm not entirely happy with that method is that it is platform specific. I would prefer...
1
5843
by: William Stacey [MVP] | last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ rooted path (similar to a VDir in IIS). Path.Combine alone will not do the job in all cases. I also need to be sure the no funny business can go on in the passed "path" that would produce a path not in the root (i.e. "..\..\dir1"). Here is my first stab at it, but...
4
3246
by: python | last post by:
Bad file names, i.e. filenames the OS considers illegal, will cause functions in the os.path module to raise an error. Example: import os.path print os.path.getsize( 'c:/pytest/*.py' ) On Windows XP using Python 2.5.2 I get the following traceback:
34
5321
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> os.startfile("C:\Documents and Settings\Alex\My Documents\My
8
11473
by: moondaddy | last post by:
I'm posting code for a user control ( FunctionConnectorSelector) below which has 3 content controls in it. each content control uses a style from a resource dictionary merged into the app.xaml file. each control has a border with another style, and each border has a unique path inside of it. I need to dynamically add these content controls...
6
4043
by: bukzor | last post by:
I have to go into these convulsions to get the directory that the script is in whenever I need to use relative paths. I was wondering if you guys have a better way: from os.path import dirname, realpath, abspath here = dirname(realpath(abspath(__file__.rstrip("c")))) In particular, this takes care of the case of symlinked, compiled...
0
7805
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7726
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7815
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8098
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5620
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3740
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2243
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 we have to send another system
1
1339
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1060
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.