473,322 Members | 1,345 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,322 software developers and data experts.

Get File Spec of Current DLL

Does anyone know how to get the file spec of DLL from within the code?

I thought that System.Reflection.GetExecutingAssembly() would work, but
it returns the name of the program that called DLL routine, not the DLL
file itself.

Mike Buchanan

Dec 13 '05 #1
3 1857
Mike,

What do you mean by the file spec?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<Ne**@InsightfulMES.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
Does anyone know how to get the file spec of DLL from within the code?

I thought that System.Reflection.GetExecutingAssembly() would work, but
it returns the name of the program that called DLL routine, not the DLL
file itself.

Mike Buchanan

Dec 13 '05 #2
This question is related to another question I had posted in another
group asking about dragging along folders when a DLL is built.

My DLL logic uses XML and SQL script files that are stored in
subfolders under the folder where the actual .DLL is located. For
example the XML files will always be in a folder named "TxnXML". So, I
guess what I really want is the folder where the .DLL file is located.

I'd like to write some code in the .DLL that can open files regardless
of where the .DLL is installed. I've tried using a relative path such
as:

oXMLDoc.Load ("..\TxnXml\MyDoc.xml");

and I've also tried to get the current location using
System.Reflection.GetExecutingAssembly().

In both cases the path is based on the calling program and not the
actual DLL.

Dec 14 '05 #3
Assembly.GetExecutingAssembly() will get the name of the assembly in which
the current code is executing. Once you snag the assembly reference, you can
use instance methods of the Assembly class to get the location of the
assembly.

Ne**@InsightfulMES.com wrote:
This question is related to another question I had posted in another
group asking about dragging along folders when a DLL is built.

My DLL logic uses XML and SQL script files that are stored in
subfolders under the folder where the actual .DLL is located. For
example the XML files will always be in a folder named "TxnXML". So, I
guess what I really want is the folder where the .DLL file is located.

I'd like to write some code in the .DLL that can open files regardless
of where the .DLL is installed. I've tried using a relative path such
as:

oXMLDoc.Load ("..\TxnXml\MyDoc.xml");

and I've also tried to get the current location using
System.Reflection.GetExecutingAssembly().

In both cases the path is based on the calling program and not the
actual DLL.


--
http://jaysonknight.com

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200512/1
Dec 14 '05 #4

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

Similar topics

5
by: Andrew Slentz | last post by:
I have a format file which is working but not correctly. It is, for some reason, dropping the first line of the input .csv file. The problem is something with the second coulumn of data having...
20
by: Nick | last post by:
Right now I'm using document.write("<script language='javascript' src='jsFile" + i + ".js'></script>"); It works -- I have a lot of data in each file and only want the visitor to have to...
11
by: Grim Reaper | last post by:
I am importing a .csv file into Access that has 37 fields. My problem is that sometimes the last field only has data at the end of the column (it looks like when you import a file into Access, for...
68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
68
by: vim | last post by:
hello everybody Plz tell the differance between binary file and ascii file............... Thanks in advance vim
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
1
by: Martin Pöpping | last post by:
Hello, I´ve a problem with parsing a double value from an xml file. My code looks like this: int concept_id; double rank; XmlElement root = documentXMLString.DocumentElement; XmlNodeList...
12
by: macus | last post by:
Dear All, I have 2 cvs file like this: <spec.csv> Type,sybType,ID CASH,ON,1 FRA,1x4,2 ...
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
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.