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 6473551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:28:46+00:00 2026-05-25T06:28:46+00:00

[EDIT] I try to open a file from a folder in my base directory.

  • 0

[EDIT]

I try to open a file from a folder in my base directory.

From the solution explorer, there is a folder “Docs” and a pdf file in it (tempPDF.pdf).
That will corresponds to a folder in my Project Folder. (e.g. Project\Docs) this is in the save level as bin and properties folders.

String assemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);

Process proc = new Process();
proc.StartInfo = new ProcessStartInfo()
{
    FileName = assemblyPath + "\\Docs\\tempPDF.pdf"
};
proc.Start();

I have already changed the Build Action to “Resource” and Copy to Output Directory to “Copy Always”. Yet, the pdf file is not copies to the bin, nor the file can be specified by the program. I clean, build and rebuild the solution.

Path kept pointing to bin\Debug folder because this is where the executables is located but the files are location at the same level as bin.

I can simply specific my image in XAML by a path like “Images\img.png”, and it will find the image relatively.

This is supposed to be a very simple question – open a PDF from a mouse click.

[EDIT – with answer]

Have to change Build Action to “Embedded Resource”, NOT “Resource” (Resource only copy a empty folder without the files). I don’t know why though.

  • 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-25T06:28:47+00:00Added an answer on May 25, 2026 at 6:28 am

    First, there is no XAML solution for that. We cannot execute a process without code-behind assistance.

    The URI you show is relative to the current assembly.
    You can use the assembly directory path then append the relative path of the file.
    It can be something like this:

    String assemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
    
    Process proc = new Process();
    proc.StartInfo = new ProcessStartInfo()
    {
        FileName = assemblyPath + "\\Docs\\somePDF.pdf"
    };
    proc.Start();
    

    If you want to put your documents in the application folder, you can also use that directory path instead of the assembly path:

    string appPath = Path.GetDirectoryName(Application.ExecutablePath);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: From another question I provided an answer that has links to a lot
I need to open a html help file from within a legacy windows application
I have application reads in data from text file. Recently I realized that I
I want to open some file from my application, file are created by the
I serve static KML from the blobstore as a file that I saved to
Are there any R users aware of an "open file"-type function in R? Preferably
I have an application that imports data from a pickled file. It works just
In Visual Studio 2008 when I open a XAML file from the project it
When I try to edit texts in my iPhone application ( UITextfield ), it
I receive this message (see image below) when I try to edit in debugging.

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.