Alexandre
Alexandre

Reputation: 7212

Clickonce "copy if newer" always download the file

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" ?

Upvotes: 0

Views: 866

Answers (1)

vcsjones
vcsjones

Reputation: 141638

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".

Upvotes: 1

Related Questions