简体   繁体   中英

.NET application access denied to create a subfolder in AppData folder

This has me a little bewildered at the moment. I have a .NET application which I have made an installer for via WIX 3.5. My app has some per-user files that it creates and uses during runtime so I am planning to create a \\MyApp subfolder in AppData.

var directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "MyApp");

if(!Directory.Exists(directory)){
    Directory.Create(directory);
}

However, this doesn't seem to work once the app is installed via the installer. Thoughts?

而不是使用Environment.SpecialFolder.ApplicationData,使用Environment.SpecialFolder.LocalApplicationData

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM