How to store user application data in a .net console application

My scenario is I am creating a small cli application that I want to store user data in some local user cache.

I suppose I'm looking for something similar to the Environment.SpecialFolder.ApplicationData path, but in the dotnet core and cross-platform.

+5
source share
1 answer

I know that this is not quite the same, but I solved it by saving the data in the application folder like this:

var userDataPath = Path.Combine(AppContext.BaseDirectory, "userdata.json"); 

Of course, you can also take a subfolder of AppContext.BaseDirectory .

0
source

Source: https://habr.com/ru/post/1259453/


All Articles