点击“复制(如果较新)”总是下载文件 [英] Clickonce "copy if newer" always download the file
问题描述
我的点击应用程序具有必须包含在应用程序根目录中的.ini文件(来自3方dll的配置)。
我将该文件添加为链接,并将其标记为内容,并将其复制为更新。
问题是,每次我部署更新时,请再次下载文件覆盖所有更改。
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.
为什么点击不符合 copy if newer
?
推荐答案
为什么clickonce不因为在复制到bin时,编译器使用(或者二进制文件被编译到哪里),所以使用的是copy if newer?
Why clickonce is not respecting "copy if newer" ?
< )。此设置与clickonce无关。
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.
我建议将您的INI重命名为base.ini或一些等效项。当您的应用程序启动时,将其复制到具有新名称的新文件中,并且仅当它不存在时才会。如下所示:
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");
}
编辑:
您可以将您的文件标记为ClickOnce清单中的数据文件。为此,
You may be able to mark your file as a data file in your ClickOnce manifest. To do this,
- 打开项目的属性
- 选择发布 / li>
- 单击应用程序文件...按钮
- 在文件列表中查找INI文件,并将发布状态更改为数据文件。
这篇关于点击“复制(如果较新)”总是下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!