问题
What is the difference between the magic paths in these namespaces:
Environment.SpecialFolder.LocalApplicationData
versus
Application.LocalUserAppDataPath
And
Environment.SpecialFolder.ApplicationData
versus
Application.CommonAppDataPath
etc...
回答1:
They are not the same. The Application version of them is aware of ClickOnce deployment, adjusting the paths accordingly to keep them isolated.
回答2:
On Windows 7:
Environment.SpecialFolder.LocalApplicationData = C:\Users\username\AppData\Local
Application.LocalUserAppDataPath = C:\Users\username\AppData\Local
Environment.SpecialFolder.ApplicationData = C:\Users\username\AppData\Roaming
Application.CommonAppDataPath = C:\Users\username\AppData\Roaming
Local is only ever stored on the local machine. Roaming is copied to the domain server (when in a domain) and is then loaded back onto other machines in that domain when you log on.
来源:https://stackoverflow.com/questions/8369627/c-sharp-difference-between-environment-specialfolders-and-application-folders