david
david

Reputation: 763

Vs.net Setup Project conditional if File Exists

Friends How to Set This Code VS.NET Setup Conditions.

<Copy Condition="!Exists($(DestPath)database.dat)"
      SourceFiles="$(SrcPath)database.dat"
      DestinationFolder="$(DestPath)"/>

Source Link

Upvotes: 1

Views: 1383

Answers (1)

Cosmin
Cosmin

Reputation: 21416

You can try this approach:

  • go to Launch Conditions Editor in your setup project
  • create a new file search and configure it to find your file
  • remember the installer property used by this search
  • go to File System Editor
  • select your file
  • in its Properties pane set Condition field to the search property negated; for example, if the search property is named MY_FILE_SEARCH, the condition can be:

    NOT MY_FILE_SEARCH

This way the file is installed only if the search doesn't find anything.

Upvotes: 2

Related Questions