.NET CORE 3.1 Console Application: How to reference data path from another drive

deskcheck1-0579 411 Reputation points
2022-01-07T00:06:22.983+00:00

Hi,

I have a .NET Core 3.1 Console Application that has a working data folder located in a different drive from where my VS Project/Solution is located. It's a huge data folder (about half a terabyte size).

It seems like my .netcore3.1 application is looking for the data inside the .netcore3.1 folder.

How do I reference the other drive where my data is located? Right now it's throwing a "DirectoryNotFoundException".

Must I place the working folder in the same drive/directory where my application is located? I have my app in my computer's C Drive. But since the working data folder is huge, I need to place it inside a different drive with bigger capacity than my C Drive. My C Drive is reserve for applications only.

Appreciate any advice.

.NET CLI
.NET CLI
A cross-platform toolchain for developing, building, running, and publishing .NET applications.
323 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,125 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,926 Reputation points
    2022-01-10T17:07:04.69+00:00

    core 3.1 does not work any different than any other windows app. file paths are relative to the working folder you run the app from. the file path syntax is the same for all windows apps.

    how are you specifying the path in code?

    is a user running the app, or a system service?

    does the user running the app have permission to the folder and files?

    0 comments No comments