Clickonce “copy if newer” always download the file

喜你入骨 提交于 2019-12-13 06:26:18

问题


My clickonce App has an .ini file(config from a 3 party dll) that must be included on app root directory. I added the file as link and mark as "content" and "copy if newer". The problem is that every time that I deploy an update, clickonce download the file again overwriting all changes.

Why clickonce is not respecting "copy if newer" ?


回答1:


Why clickonce is not respecting "copy if newer" ?

Because that's used by the compiler when copying to the bin (or where ever the binaries are compiled to). This setting has nothing to do with clickonce.

I would recommend renaming your INI to "base.ini", or some equivalent. When your application starts, copy it to a new file with the new name if, and only if, it doesn't exist already. Something like this:

if (!File.Exists("yourinifile.ini"))
{
    File.Copy("base.ini", "yourinifile.ini");
}

EDIT:

You may be able to mark your file as a data file in your ClickOnce manifest. To do this,

  1. Open the properties of your project
  2. Select the "Publish" tab
  3. Click the "Application Files..." button
  4. Find your INI file in the list of files, and change the Publish Status to "Data File".


来源:https://stackoverflow.com/questions/11511609/clickonce-copy-if-newer-always-download-the-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!