472,374 Members | 1,417 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

from within an assembly, How to get its name and path?

Hello,

What is the easiest (and cleanest) way to get from within an assembly
information such as assembly path and name.

eg:
current assembly is:
C:\temp\blabla.dll

I just want to get this "C:\temp\blabla.dll" string back.
Thanks,
José
Jul 19 '05 #1
4 21009
Jon,

As always you're really quick :-)

Thanks,
José
"Jon Skeet" <sk***@pobox.com> wrote in message
news:MP************************@news.microsoft.com ...
José Joye <jo*******@KILLTHESPAMSbluewin.ch> wrote:
What is the easiest (and cleanest) way to get from within an assembly
information such as assembly path and name.

eg:
current assembly is:
C:\temp\blabla.dll

I just want to get this "C:\temp\blabla.dll" string back.


Assembly.GetExecutingAssembly().CodeBase;

That will give it as file:///c:/temp/blabla.dll - you can check for and
strip off the file:/// though if you want. (Don't forget that the
assembly may not have been loaded from disk.)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too

Jul 19 '05 #2
Assembly.GetExecutingAssembly().CodeBase;


I'd use Assembly.GetExecutingAssembly().Location instead.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Jul 19 '05 #3
Use:

Assembly.GetExecutingAssembly().Location

-------------------------
"Manish Agarwal"- <ma***********@hotmail.com>

"José Joye" <jo*******@KILLTHESPAMSbluewin.ch> wrote in message
news:Oy**************@TK2MSFTNGP10.phx.gbl...
Hello,

What is the easiest (and cleanest) way to get from within an assembly
information such as assembly path and name.

eg:
current assembly is:
C:\temp\blabla.dll

I just want to get this "C:\temp\blabla.dll" string back.
Thanks,
José

Jul 19 '05 #4
Mattias Sjögren <ma********************@mvps.org> wrote:
Assembly.GetExecutingAssembly().CodeBase;


I'd use Assembly.GetExecutingAssembly().Location instead.


Yup, that is indeed a better way.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Jul 19 '05 #5

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

Similar topics

4
by: José Joye | last post by:
Hello, What is the easiest (and cleanest) way to get from within an assembly information such as assembly path and name. eg: current assembly is: C:\temp\blabla.dll I just want to get...
0
by: karunakar | last post by:
Hi All I am not able to read the class name I want read the particular class name string path = System.Configuration.ConfigurationSettings.AppSettings; string className = path + ".User";...
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...
7
by: rfinch | last post by:
Very new to this but using the MS working with dynamics CRM 3.0 book to run web application to retrieve lead records from CRM 3.0. Have followed the book instructions on page 380-382. But am...
9
by: MikeB | last post by:
Hi, I'd appreciate some help, please. I'm writing a VS2005 VB project for school and one of the requirements is that every screen should have a "Help" button. I could do it by writing a clumsy...
6
by: HONOREDANCESTOR | last post by:
Suppose I have a dll which might be installed in the directory c: \MyClass\. I want to be able to find the path of this dll from within the dll. In other words, I want a function that can return...
3
by: Alex | last post by:
Hi, I'm having a booger of a time trying to understand the policies for VB 2005 so I can run the EXE file from a network share via mapped drive. My first route was to use the Global Assembly...
1
by: nish85 | last post by:
Hi, i have uploaded my sit to web server goddady.com i have a button to download dyanmically generated excel file.This button is ajax enabled.....When i am click on this button it will popup a...
9
by: =?Utf-8?B?VGhvbWFzIFcuIEJyb3du?= | last post by:
"parez" wrote: Assembly.LoadWithPartialName does indeed work!! Now, why is this incredibly useful routine deprecated and we are instructed to use Assembly.Load instead which does not provide...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.