Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 216565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:34:34+00:00 2026-05-11T18:34:34+00:00

How do I get the path of the current assembly? I need to get

  • 0

How do I get the path of the current assembly? I need to get data from some paths relative to the location of hte current assembly (.dll).

I thought someone told me to use the reflection namespace but I can’t find anything in there.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:34:35+00:00Added an answer on May 11, 2026 at 6:34 pm

    You can use:

    string path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath;
    

    Some suggestions in the comments are to pass that through System.Uri.UnescapeDataString (from vvnurmi) to ensure that any percent-encoding is handled, and to use Path.GetFullpath (from TrueWill) to ensure that the path is in standard Windows form (rather than having slashes instead of backslashes). Here’s an example of what you get at each stage:

    string s = Assembly.GetExecutingAssembly().CodeBase;
    Console.WriteLine("CodeBase: [" + s + "]");
    s = (new Uri(s)).AbsolutePath;
    Console.WriteLine("AbsolutePath: [" + s + "]");
    s = Uri.UnescapeDataString(s);
    Console.WriteLine("Unescaped: [" + s + "]");
    s = Path.GetFullPath(s);
    Console.WriteLine("FullPath: [" + s + "]");
    

    Output if we’re running C:\Temp\Temp App\bin\Debug\TempApp.EXE:

    CodeBase: [file:///C:/Temp/Temp App/bin/Debug/TempApp.EXE]
    AbsolutePath: [C:/Temp/Temp%20App/bin/Debug/TempApp.EXE]
    Unescaped: [C:/Temp/Temp App/bin/Debug/TempApp.EXE]
    FullPath: [C:\Temp\Temp App\bin\Debug\TempApp.EXE]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to get the current folder path from within a XSLT
Possible Duplicates: Getting the path of the current assembly C#: How do I get
I need to get the last part of current directory, for example from /Users/smcho/filegen_from_directory/AIRPassthrough
How to get the path of the current csproject? Let's say I have a
The VB trick to get the path of the current temporary directory: Private Declare
How do I get the path to the machine.config from a .Net application? It
I need to get the path to the native (rather than the WOW) program
How can I programatically get the path to MSBuild from a machine where my
Is there a way to get the path for the assembly in which the
I am trying to get current directory, but its giving me path of DEBUG

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.