Code Snippet posted by:
Niladri.Biswas | Posted on: 5/11/2012 | Category:
C# Codes | Views: 742 | Status:
[Member] |
Points: 40
|
Alert Moderator
Solution 1:
var path = AppDomain.CurrentDomain.BaseDirectory;
Solution 2:
var fullCurrentAssemblyPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
var path = Path.GetDirectoryName(fullCurrentAssemblyPath);
Solution 3:
var codeBase = System.Reflection.Assembly.GetExecutingAssembly().CodeBase;
var uri = new UriBuilder(codeBase);
var path = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path));
Solution 4:
var filePath = new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath;
var path = Path.GetDirectoryName(filePath);
Solution 5:
var path = Environment.CurrentDirectory;
Hope this helps
Best Regards,
Niladri Biswas