WebJan 14, 2015 · So here is a quick method that you can use to return the directory of the current executable that takes the URI into account: public static DirectoryInfo GetExecutingDirectory () { var location = new Uri (Assembly.GetEntryAssembly ().GetName ().CodeBase); return new FileInfo (location.AbsolutePath).Directory; } WebJul 5, 2013 · System.Reflection.Assembly.GetEntryAssembly().Location If you want the assembly that's consuming your library (which could be the same assembly as above, if your code is called directly from a class within your executable): System.Reflection.Assembly.GetCallingAssembly().Location If you'd like just the …
c# - Which is better for getting assembly location , GetAssembly ...
WebJul 25, 2011 · 3 Answers. Sorted by: 6. var assembly = Assembly.GetExecutingAssembly (); var path = assembly.Location; See the MSDN page. This is the path after any shadow copying. The CodeBase property will give the location before shadow-copying. Share. Improve this answer. WebNov 21, 2014 · The answer may seem obvious that it is Assembly.GetExecutingAssembly (), but sometimes it's not. Imagine that you are trying to load the application.config file associated with the executable, then the path will most probably be Assembly.GetEntryAssembly ().Location to always get the path of the "process". chiocciol pizzeria キオッチョラ ピッツェリア 秋葉原udx店
c# - How do I get the path of the assembly the code is in?
WebNov 19, 2016 · There's Environment.CurrentDirectory if you want the working directory, or Path.GetDirectoryName (typeof (Foo).Assembly.ManifestModule.FullyQualifiedName) to find the location of an assembly (or at least its manifest module, which will be the same thing in almost all cases). Share Follow edited Oct 31, 2008 at 13:41 answered Oct 31, … WebApr 10, 2024 · Get Executable Path With the Assembly Class in C# The Assembly class represents an assembly that is a reusable building block of a common language runtime … WebTwo options... regardless of application type you can always invoke: Assembly.GetExecutingAssembly().GetName().Version If a Windows Forms application, you can always access via application if looking specifically for product version.. Application.ProductVersion chip1stop クーポン