开发者

Install a file which should be removed only on real uninstall and never overwritten

When I install my application, along with the binaries, a conf file is installed that the user can change as he needs (it's actually the user data file). I would like this file to not be overwritten or deleted when a repair, upgrade, modify happens and it should be deleted only when a real uninstall happens. In other words: this conf file is installed along with the binaries and should never be touched again (overwritten/deleted) until a real uninstall happen开发者_高级运维s (not repairs, modifies, upgrades) in which case it should be deleted.

So I was thinking of doing:

<Component Id="aaa.cfg" Guid="GUID"> <File Id="aaa.cfg" Source="aaa.cfg" KeyPath="yes" /> </Component>

But I don't know how could I condition the component so that:

  1. the component to be removed only on a real uninstall - not upgrades, repairs, modifies?

  2. the file should in no case be overwritten if already exists.


The easiest way to address 2 would probably be to install it as a "template", and have the application copy this template to the "final" location, if it doesn't exist. (If it's a user file, install the template alongside your application, and make the final copy somewhere appropriate, under %USERPROFILE%)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜