Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

how to get the directory of the project in c#

using System;
using System.IO;

// This will get the current WORKING directory (i.e. inDebug)
string workingDirectory = Environment.CurrentDirectory;
// or: Directory.GetCurrentDirectory() gives the same result

// This will get the current PROJECT bin directory (ie ../bin/)
string projectDirectory = Directory.GetParent(workingDirectory).Parent.FullName;

// This will get the current PROJECT directory
string projectDirectory = Directory.GetParent(workingDirectory).Parent.Parent.FullName;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #directory #project
ADD COMMENT
Topic
Name
2+5 =