Where can I safely store data files for a ClickOnce deployment?

后端 未结 3 571
陌清茗
陌清茗 2020-12-31 04:19

I have been using ApplicationDeployment.CurrentDeployment.DataDirectory to store content downloaded by the client at runtime which is expected to be there every

3条回答
  •  无人及你
    2020-12-31 04:54

    Check out IsolatedStorage this should help. It even works in partial trust environments.

    To keep you data you need to use the application scoped IsolatedStorage

    using System.IO;
    using System.IO.IsolatedStorage;
    ...
    
    IsolatedStorageFile appScope = IsolatedStorageFile.GetUserStoreForApplication();    
    using(IsolatedStorageFileStream fs = new IsolatedStorageFileStream("data.dat", FileMode.OpenOrCreate, appScope))
    {
    ...
    

    code taken from this post

提交回复
热议问题