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

  • SEARCH
  • Home
  • 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

From Visual C++, how do I get the path to the current user's My
Possible Duplicates: Getting the path of the current assembly C#: How do I get
How do you get the current path (url) from within an asp.net mvc view?
I want to get a dll's directory (or file) path from within its code.
Possible Duplicate: How can i get the path of the current user's “Application Data”
How can I get the current working directory and get the path without the
I'm working on a tool that needs to get the current user's wallpaper path.
How can I get runnig path of my application from app.xaml.cs itself?
I need to get a path to the GIT on Max OS X 10.6
Request.Path will get the current Path name with file name such as: C:/......./Personal/Items.aspx How

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.