How to get path to running Assembly? (C#)

by Vitaly Zayko 14. December 2008 23:00

In this post I explained how to find this directory in .NET Compact Framework. Here is how to do this in desktop Applications.

If you are working on a Windows Forms App you, can make this call:

System.IO.Path.GetDirectoryName(Application.ExecutablePath);

In non-WinForms Apps use this:

System.IO.Path.GetDirectoryName(
System.Reflection.
Assembly.GetEntryAssembly().Location);

Note that last back slash is not included.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Tags:

Code Snippets

Comments are closed

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

Calendar

<<  March 2010  >>
MoTuWeThFrSaSu
22232425262728
1234567
891011121314
15161718192021
22232425262728
2930311234

View posts in large calendar

About the author

Vitaly Zayko

Senior Software Developer / Team Lead / Product Manager

Moscow, Russia