Finding Directory of Project

G

Guest

Hi, is there a way to get the directory of the current C# Project to be used for by an addin. When I do the Directory.getCurrentDirectory(), it sends back a reference to the IDE (C:\Program Files\Microsoft Visual Studio.NET 2003\), but I want the path to the current project, such as D:\VS.NET Projects\MyProject1\. Thanks for the help in advance.
 
W

William Ryan eMVP

Assembly.GetExecutingAssembly().Location

Keith La Force said:
Hi, is there a way to get the directory of the current C# Project to be
used for by an addin. When I do the Directory.getCurrentDirectory(), it
sends back a reference to the IDE (C:\Program Files\Microsoft Visual
Studio.NET 2003\), but I want the path to the current project, such as
D:\VS.NET Projects\MyProject1\. Thanks for the help in advance.
 
G

Guest

This may or may not be a problem for you but ..

You need to be careful if you are planning on adding your assembly to the GAC. Assembly.GetExecutingAssembly().Location will return the location of the assembly that is running from the GAC - and this will not be of much use to you

To be honest, the only way i have found getting the location of an assembly to work correclty when an assembly may or may not be added to the GAC is to use a really well known location - such as the Registry

RS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top