.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Retrieving the plugin path - C#

3 REPLIES 3
Reply
Message 1 of 4
Fergobirck
1318 Views, 3 Replies

Retrieving the plugin path - C#

Hello everyone,

 

It's my first post in here. I did a little search for this question but didn't found anything.

 

I'm developing a plugin for Autocad using C#. In the same folder of the plugin DLL, I have subfolder (let's call it "data") that contains a lot of files that my plugin will use. In order to make the program work indepedent of the location of the DLL file (and the subfolder), I need to get the directory of my plugin dll. Anyone knows how can I achieve this? If this was a regular C# Winforms application, I would use "Application.StartupPath", but that's not available when developing an Autocad plugin.

 

Thanks in advance,

Fergo.

3 REPLIES 3
Message 2 of 4
hgasty1001
in reply to: Fergobirck

Hi,

 

This slould work: System.Reflection.Assembly.GetExecutingAssembly.Location

 

Gaston Nunez

Message 3 of 4
dgorsman
in reply to: hgasty1001

You might also want to try a more traditional route of using the registry, so that the data can be located on a personal network drive, common read-only network location, or similar place where a DLL might not be appropriate.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 4 of 4
Fergobirck
in reply to: dgorsman

Thank you both for the answer. Turns out the StreamReader accepts relative paths, so all I needed to do was ".\\folder\\". Kind regards, Fergo.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost