471,325 Members | 1,233 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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 GetModuleFileName API ?
Dec 21 '05 #1
4 3664
Hi,

Arey ou talking about a .net assembly ?
If so you can use Assembly.Location , 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*@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.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 GetModuleFileName 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.Location , 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*@discussions.microsoft.com> wrote in message
news:58**********************************@microsof t.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 GetModuleFileName API ?


Dec 22 '05 #3
Hi,

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

I am using:
string path = System.Reflection.Assembly.GetAssembly(this.GetTyp e()).Location;

This give path a value of:
C:\Program Files\Microsoft Dynamics\GP\AddIns\Workflow.dll

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

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

Or is there a way I can strip out the "Workflow.dll" 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.Location , 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*@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.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 GetModuleFileName API ?


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

string yourDirectory = Path.GetDirectoryName(yourPathAsString);
"eieed" <ei***@discussions.microsoft.comwrote in message
news:3E**********************************@microsof t.com...
Hi,

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

I am using:
string path =
System.Reflection.Assembly.GetAssembly(this.GetTyp e()).Location;

This give path a value of:
C:\Program Files\Microsoft Dynamics\GP\AddIns\Workflow.dll

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

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

Or is there a way I can strip out the "Workflow.dll" 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.Location , 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*@discussions.microsoft.comwrote in message
news:58**********************************@microso ft.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 GetModuleFileName API ?



Feb 27 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

31 posts views Thread by John Roth | last post: by
9 posts views Thread by Bengt dePaulis | last post: by
70 posts views Thread by Michael Hoffman | last post: by
34 posts views Thread by Reinhold Birkenfeld | last post: by
2 posts views Thread by Rob Cowie | last post: by
1 post views Thread by William Stacey [MVP] | last post: by
6 posts views Thread by bukzor | 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.