Hack Forums
[.NET] How do i get the path of my project directory at designtime - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] How do i get the path of my project directory at designtime (/showthread.php?tid=1820506)

Pages: Pages 1 2


How do i get the path of my project directory at designtime - BlackCap - Oct 14, 2011

I am making a custom control designer inside of VS, and i need to find a way to add a designer file for the custom controls that are made in my designer.
My problem is that i can't find a way to get the path of the project directory at design time, all the usually methods returns the path of the Vs folder :/

Any ideas? :)


* - Sapientia - Oct 14, 2011

Can you please elaborate? What file do you want to open?


* - BlackCap - Oct 14, 2011

(Oct 14, 2011 01:33 PM)¢aявøn ғιвєя Wrote:  Can you please elaborate? What file do you want to open?

The project folder, where all the code files are stored.


* - n0$f3ratu$ - Oct 14, 2011

(Oct 14, 2011 01:36 PM)1steinar Wrote:  The project folder, where all the code files are stored.

Code
"System.Reflection.Assembly.GetAssembly().Location" ???



* - BlackCap - Oct 14, 2011

(Oct 14, 2011 01:41 PM)n0$f3ratu$ Wrote:  
Code
"System.Reflection.Assembly.GetAssembly().Location" ???

Nope, at design time it returns a location in the appdata even througth my project is both builded and saved..


* - SomeWhiteGuy - Oct 14, 2011

Dim AppPath As String = My.Application.Info.DirectoryPath


* - BlackCap - Oct 14, 2011

(Oct 14, 2011 02:37 PM)dr3am Wrote:  Dim AppPath As String = My.Application.Info.DirectoryPath

I have allready tryed it and it does not work at design time


* - SomeWhiteGuy - Oct 14, 2011

(Oct 14, 2011 02:40 PM)1steinar Wrote:  I have allready tryed it and it does not work at design time

I don't understand what you're trying to do.

/Elaborate


* - Charger - Oct 14, 2011

What do you mean at "Design Time"? Are you talking about when you debug it ?


* - Banksу - Oct 14, 2011

Like when you are debugging it? I believe that's because you're either using a temporary project, or that's just how Visual Studio works with debugging.


* - Coleak - Oct 14, 2011

Are you think about Application.StartPath? Im confused.


* - BlackCap - Oct 15, 2011

(Oct 14, 2011 04:47 PM)Вanksy Wrote:  Like when you are debugging it? I believe that's because you're either using a temporary project, or that's just how Visual Studio works with debugging.

This is design time:
Spoiler (Click to View)

Like a sayed, it's a custom designer to create custom controls (like the form designer), and i neded the path of the project so that i could generate designer files for the custom controls made with it.
Just in case someone else need it, i managed to get the path from the EnvDTE.DTE class found in the EnvDTE dll.


* - Coleak - Oct 15, 2011

Look at my above post, use Application.Startpath


* - BlackCap - Oct 15, 2011

(Oct 15, 2011 02:14 AM)Coleak Wrote:  Look at my above post, use Application.Startpath

You should test it before you post. It where the first method i tested, and i't returns a location in the appdata.


* - n0$f3ratu$ - Oct 15, 2011

(Oct 15, 2011 02:36 AM)1steinar Wrote:  You should test it before you post. It where the first method i tested, and i't returns a location in the appdata.

Alright, then what is the problem?
Take the path from appdata, because is obvious you put the "working" folder there.