none
How do I add a non binary file to a publish deployment?

    Question

  • Question: How do I add a non executable file to the deploy package?

    The most common way to add a file is to load it into the assembly as part of the project space.  But I can not use this method.

    Here's the problem:

    When I do a release compile, in the post build step, it calls another program called, "ReleaseNotesGenerator"  This program grabs the version number of the file I just created, and allows you to enter release notes into a .dat file in the same directory as the executable.

    By this point the executable is finalized and I can't modify the binary contents and re-embed the ReleaseNotes.Dat.  I also can not call "ReleaseNotesGenerator" prebuild because the build number does not change until the build begins.  (I'm using 1.0.* in the assembly info)

    Once this program is done executing, the publish releases all the files.

    I want to include that generated ReleaseNotes.Dat file from the post build step.


    Friday, August 23, 2013 9:47 PM

Answers

  • But I'm confused that you havn't mentioned anything about you have tried to create a setup. May I ask one question: Does publish deployment actually mean the release folder?

    Regards,


    Barry Wang
    Hi Barry,

    I have found a work around by modifying the release notes before the build takes place.  It's not a favorite solution as the release build may fail.  But it works.

    But to answer your question:

    Yes I have done mutliple successful one click publishes and tested the one click deployment.

    I wanted to include "ReleaseNotes.dat" in the one click deployment & publish.  The usual manner of doing this is by:

    1.   Adding the file to your project as a resource.

    2.   Right click on that file in solution explorer, select properties and change the type to "content."

    However whenever I did this, the one click publish would crash while the regular release compile would work.

    The file is located in the proper directory and I do a File.Exist before I try to open it.

    My Guess As To What the problem seems to be:

    My assemblies are strongly signed, so there's a file hash associated with the ReleaseNotes.Dat resource.  I modify the ReleaseNotes.dat content file during the post build command (hence modifying what the file hash for ReleaseNotes.dat was supposed to be).   (But before the 1 click publish) When the program tries to open the .dat file, it blows up.  (Maybe because hash #'s don't match)

    I can run the program successfully from a release build (Non click and publish).






    Wednesday, August 28, 2013 2:17 PM

All replies

  • You can put the revision into the file properties which is the info you see when you hover over the filew with a windows explorer.  See webpage below

    http://www.codeproject.com/Articles/3615/File-Information-using-C


    jdweng

    Friday, August 23, 2013 10:06 PM
  • Hi Donald,

    I am moving your thread into the ClickOnce and Setup & Deployment Projects Forum for dedicated support. Thanks for your understanding.

    Best Regards,


    Jack Zhai[MSFT]
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, August 26, 2013 7:40 AM
  • Thanks Jack.  I didn't know this forum was here.

    Most solutions have you bind the file inside the executable as a file (and change the binding type in properties).

    I can do this, right before the publish by a post build command. 

    Problem is there seems to be a hash tag associated with the binding.  And if you modify the file AFTER the build, the hash tag will be incorrect.  When you try to deploy it and execute, it goes BOOM!  (Security issue maybe?)

    It seems this might not be possible to modify a binded resource after the build.


    • Edited by Donald Hess Monday, August 26, 2013 2:25 PM
    Monday, August 26, 2013 2:22 PM
  • Hi Donald Hess,

    Welcome to the MSDN forum.

    I'm not so sure if I have understand your issue clearly so here is my understanding:

    You have a file that you cannot modify it before you publish it. So you are looking for a way to include it within your setup. 

    But I'm confused that you havn't mentioned anything about you have tried to create a setup. May I ask one question: Does publish deployment actually mean the release folder?

    Regards,


    Barry Wang
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Tuesday, August 27, 2013 6:11 AM
  • But I'm confused that you havn't mentioned anything about you have tried to create a setup. May I ask one question: Does publish deployment actually mean the release folder?

    Regards,


    Barry Wang
    Hi Barry,

    I have found a work around by modifying the release notes before the build takes place.  It's not a favorite solution as the release build may fail.  But it works.

    But to answer your question:

    Yes I have done mutliple successful one click publishes and tested the one click deployment.

    I wanted to include "ReleaseNotes.dat" in the one click deployment & publish.  The usual manner of doing this is by:

    1.   Adding the file to your project as a resource.

    2.   Right click on that file in solution explorer, select properties and change the type to "content."

    However whenever I did this, the one click publish would crash while the regular release compile would work.

    The file is located in the proper directory and I do a File.Exist before I try to open it.

    My Guess As To What the problem seems to be:

    My assemblies are strongly signed, so there's a file hash associated with the ReleaseNotes.Dat resource.  I modify the ReleaseNotes.dat content file during the post build command (hence modifying what the file hash for ReleaseNotes.dat was supposed to be).   (But before the 1 click publish) When the program tries to open the .dat file, it blows up.  (Maybe because hash #'s don't match)

    I can run the program successfully from a release build (Non click and publish).






    Wednesday, August 28, 2013 2:17 PM
  • Hi Donald Hess,

    Thanks for sharing your workarounds here. However, it seems you will still fail to use clickonce deployment. If so, maybe some other actions should be take to aviod strict hash check.

    Regards,


    Barry Wang
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, August 29, 2013 3:17 AM