Visual Studio Setup Project conditional if File Exists

后端 未结 4 920
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 15:36

I have a Setup/Deployment Project for my Application and it outputs certain files (*.dll, *.dat) to the Application Folder.

I would like a condition to be set to che

4条回答
  •  孤城傲影
    2020-12-05 16:15

    To only install a file, if it doesn't already exist, follow these steps:

    1. Add a "Search Target Machine" entry under the "Launch Conditions" view in your setup project.

    2. fill in the FileName property and the Folder property.

    3. the Property property should be a constant you can remember, like "MY_AWESOME_FILE_EXISTS"
    4. in the "File System" view of your project, locate the component to install and add this to the Condition property "not MY_AWESOME_FILE_EXISTS"

    That is all.

    Sources (since I just had to figure this out for myself):

    • Condition Property
    • Conditional Statement Syntax
    • Conditional Install if a file exists
    • Searching for Existing Applications, Files, Registry Entries or .ini File Entries

提交回复
热议问题