473,320 Members | 1,848 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,320 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 21057
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.