What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 5468 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > C# > How to get the path/directory for the current assembly? ...
Niladri.Biswas

How to get the path/directory for the current assembly?

 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
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 2:54:24 PM