473,507 Members | 3,706 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WHat is the Directory?

GTi
I have created a "DLL LIB" in c# that I use in several ".EXE" projects.
But I need to know where this DLL fil is located on disk from inside my
DLL,
NOT where the EXE file is located.

What function must I use to get the directory of the DLL file ?

Dec 22 '05 #1
5 1162
GTi wrote:
I have created a "DLL LIB" in c# that I use in several ".EXE" projects.
But I need to know where this DLL fil is located on disk from inside my
DLL,
NOT where the EXE file is located.

What function must I use to get the directory of the DLL file ?

Inside you dll, do the following:

string location = typeof(AClassInYourDll).Assembly.Location

HTH,
Andy
--
To email me directly, please remove the *NO*SPAM* parts below:
*NO*SPAM*xmen40@*NO*SPAM*gmx.net
Dec 22 '05 #2
Hi,

function must I use to get the directory of the DLL file ?

Inside you dll, do the following:

string location = typeof(AClassInYourDll).Assembly.Location


You can do Assembly.GetExecutingAssembly().Location , in this case you do
not need a type
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Dec 22 '05 #3
GTi
Tx all, you saved my xmas !

Dec 23 '05 #4
GTi

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

function must I use to get the directory of the DLL file ?

Inside you dll, do the following:

string location = typeof(AClassInYourDll).Assembly.Location


You can do Assembly.GetExecutingAssembly().Location , in this case you do
not need a type
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


Hmm... still have problem using this...

Assembly.GetExecutingAssembly().Location

Does NOT return the correct path to my dll directory.

When running on a ASP.NET server it reurns:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET
Files\Development\80fad5dd\dd8b6fcb\assembly\dl3\a 16593d5\7f90b94c_6f0ac601\MyLIB.DLL

Not in my case:
c:\development\web\bin\

Any other ideas?

Dec 26 '05 #5
GTi
My development project is a ASP.NET, NT Service Agent and a Windows
Application running on the same machine.

They all need to read the same configuration file/data like database
connection string, some settings etc. And some utillity files is also
puttet on that diretcory.

The dll/exe files must be on the same directory on the computer. So
putting a config file on that directory "must be the solution".
But ASP.NET don't give me this directory at all.
Any solution of this problem.

Dec 29 '05 #6

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

Similar topics

26
4415
by: Lasse Edsvik | last post by:
Hello I'm trying to build a simple COM+ app in vs.net using C# and i cant register it in component manager..... what more is needed than this: using System; using...
0
1991
by: RTT | last post by:
here is my current situation. I develop a program on my computer's localhost. From there i contact Active directory succesfull using a connectionstring like:...
9
5226
by: Brian Hampson | last post by:
I am trying to determine all the groups which the current user has permissions to add a member. Here's my code: foreach (System.DirectoryServices.SearchResult ADSearchres in...
2
1079
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
Hi; We are writing an installer for our ASP.NET app and are hitting an argument over where the default directory for the app should be. Should it be (assuming standard folder layout): 1)...
5
2690
by: GenCode | last post by:
What is the best way to read a "readable" web directory... I know I can do this Client.DownloadFile("http://www.mydomain.com/readabledir/", c:\ \dir.txt"); But that gives me the html and all...
1
8339
by: amygrant1701 | last post by:
Hi, I've done this before so I don't see what I could doing wrong here. I'm running mysql 5x on freebsd. I'm using the default data directory of "/var/db/mysql" In there I have several dozen...
1
2056
by: rogersmithiii | last post by:
We have a production web site - www.thesite.com - laid out as follows on IIS 6: d:\Inetpub\wwwroot\default.asp There are lots of subdirectories inside of WWWROOT including a cgi-bin directory...
13
1844
by: Fro | last post by:
Hi, my site allows to upload images. For that reasons I have created a directory which have "drwxrwxrwx"-permission. I.e. everybody can write in that directory. I understand that it is not save,...
35
1922
by: Stef Mientki | last post by:
hello, I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I can think of something like: - use a relative path if drive is identical to the application (I'm still a...
0
4508
by: okonita | last post by:
Hi all, I am having a DB2 connectivity problem that I hope someone can help me resolve. I need this to test Replication and such other things. What am I doing wrong here? Any help that I can get...
0
7221
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
7109
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
7372
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...
1
7029
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...
1
5039
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3190
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
758
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.