none
Copy To Ouput Directory

    Question

  • Hello,

    does clickonce always copy files to the output directory eventhough this property is set to "copy if newer"?

    I installed a clickonce application that includes a file called text1.txt

    I did not change the content of the file. I published a new version of the project.

    The installer installed that file again. does that property work with clickonce?

    thank you.

    Tuesday, July 10, 2012 9:10 PM

Answers

  • Hi Elmina,

    If you Build or publish your project immediately, the files will not copied if it's Copy to Output Directory is set to "Copy if newer". However, if you rebuild the project, then the file will be copied and file hash will be regenerated.

    ClickOnce will compares the hash signatures of the files specified in the application manifest for the current application against the signatures in the manifest for the new version. If a file's signatures are different, ClickOnce downloads the new version. If the signatures match, the file has not changed from one version to the next. 

    I'm not sure what do you mean by installed again here. When the clickonce get update, it will redownload changed files. To these unchanged files, clickonce will copy them from the previous version folder to the new version folder. 

    In this case, the txt file will copy from the v1 folder to the v2 folder.

    In addition, you can check the hash of a file in the manifest.

    If there is anything unclear, please let me know.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by RobbieDotNet Monday, July 16, 2012 5:47 PM
    Wednesday, July 11, 2012 4:05 AM
    Moderator
  • Hi Elmina,

    When you install a ClickOnce application, it caches resources, data, and assemblies in cache folders. When you install an update, it creates a new deployment folder on the user's machine. Then it checks assemblies to see if they have been changed, and if not, copies them from the local cache to the new deployment folder. If they *have* changed, it downloads them from the server. I assume for your file, it would check to see if it has changed, and if not, it is copying it from the old version forward.

    If you mark the file as Data in the Application Files dialog, it will put it in the DataDirectory, and will copy it forward from one version to the next.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev

    Wednesday, July 11, 2012 4:58 PM
    Moderator

All replies

  • Hi Elmina,

    If you Build or publish your project immediately, the files will not copied if it's Copy to Output Directory is set to "Copy if newer". However, if you rebuild the project, then the file will be copied and file hash will be regenerated.

    ClickOnce will compares the hash signatures of the files specified in the application manifest for the current application against the signatures in the manifest for the new version. If a file's signatures are different, ClickOnce downloads the new version. If the signatures match, the file has not changed from one version to the next. 

    I'm not sure what do you mean by installed again here. When the clickonce get update, it will redownload changed files. To these unchanged files, clickonce will copy them from the previous version folder to the new version folder. 

    In this case, the txt file will copy from the v1 folder to the v2 folder.

    In addition, you can check the hash of a file in the manifest.

    If there is anything unclear, please let me know.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by RobbieDotNet Monday, July 16, 2012 5:47 PM
    Wednesday, July 11, 2012 4:05 AM
    Moderator
  • Hi Elmina,

    When you install a ClickOnce application, it caches resources, data, and assemblies in cache folders. When you install an update, it creates a new deployment folder on the user's machine. Then it checks assemblies to see if they have been changed, and if not, copies them from the local cache to the new deployment folder. If they *have* changed, it downloads them from the server. I assume for your file, it would check to see if it has changed, and if not, it is copying it from the old version forward.

    If you mark the file as Data in the Application Files dialog, it will put it in the DataDirectory, and will copy it forward from one version to the next.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev

    Wednesday, July 11, 2012 4:58 PM
    Moderator
  • Thank You. One more quick question. What happens when the computer looses connection to the server while updating the clickonce application?

    I published a new version, then I launched the program. clickonce recognized that there is a new version on the server. It started downloding.

    When the download progress bar was at 50%, I disconnected my pc from the network on purpose. a new window pops up and it says that download failed or something.

    I checked the program version and it looks like the clickonce did not install the new version.

    My question here is, did clickonce update the files that were only downloaded or did clickonce rollback and ignore the downloaded files?

    I want to make sure that the program was not partially updated.

    Thank You. 

    Thursday, July 12, 2012 12:32 PM
  • I can't find any document about this issue.

    However, I think the clickonce application will not partially updated based on the following reason.

    The downloaded file will not copied to the old version of the ClickOnce application.

    The non-downloaded file will copied from the old version to the new version, so the file in older version will not changed at all.

    The ClickOnce cache will keep two version of the application.

    Best Regards,


    Bob Wu [MSFT]
    MSDN Community Support | Feedback to us

    Monday, July 16, 2012 10:23 AM
    Moderator