Skip to content

Getting to the Project Path in Visual Studio.

October 30, 2015

A useful tip for getting the current project path the Visual Studio Project is executing in, you can use either the following: –

(I find the first one the easiest, especially if finding a specific file.

string requiredPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "folder/", name + ".fileextension"); // debug/images
var requiredPath = Path.GetDirectoryName(Path.GetDirectoryName(
System.IO.Path.GetDirectoryName( 
      System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase )));
Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: