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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:52:44+00:00 2026-06-08T17:52:44+00:00

I store the path of my database (a folder with some xml files) in

  • 0

I store the path of my database (a folder with some xml files) in the app.config. At the startup I check, if the path exists. If it doesn’t exist, I want to set the path to the default path. Code looks like this:

public void CheckAndRepairSettings()
{
        /* Check Paths */
        if(GetDatabasePath() == null)
             SetDatabasePath(System.AppDomain.CurrentDomain.BaseDirectory + "DataBase");
}

GetDatabasePath() reads the path form the app.config and SetDatabasePath() writes the path to the app.config. These Methods are working fine.

My promblem is the System.AppDomain.CurrentDomain.BaseDirectory. If I run this in my applications debug mode I get:
“F:\Office\Projekte_Software\ServiceTool\_Work\ServiceSoftware\ServiceSoftware\bin\Debug\”

I additionally use NUnit for some unit tests. If I run NUnit in debug mode I get :
“F:\Office\Projekte_Software\ServiceTool\_Work\ServiceSoftware\ServiceSoftware.UnitTests\bin\Debug”

There is no trailing Backslash “\” in the path in NUnit debug mode, so I get a non existing path when I concatenate the path-string in my CheckAndRepairSettings().

Why does this behave so different?

  • 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-06-08T17:52:45+00:00Added an answer on June 8, 2026 at 5:52 pm

    You should use Path.Combine to concatenate paths, it handles issues regarding existing/non-existing (among other things) path separators

    Why one includes ending slash the other one doesn’t is probably related to how nUnit creates the appdomain under which it runs its tests

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store a path for a special directory used by my Rails
In my application I use some icons. Where should I store the path of
I'm using Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + \MyProgram As the path to store several files used by
I'm using a sqlite3 database to store app's data. Instead of building a database
I store uploaded pictures in a folder while I store the path and filename
I store path of profile picture of my users in database and images are
I'm trying to have the user pick an audio file and store the path
My application needs to know the path to a directory where it can store
I'm developing a system which needs to store videos in the form: /path/to/video/<md5 of
I have a folder path stored in the property nightly.basepath (here the value would

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.