473,403 Members | 2,293 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,403 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 21062
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.