Creating a file with build number and branch name in SVN

后端 未结 7 1002
醉话见心
醉话见心 2021-01-22 06:26

There is not an enourmous amount of deployment control where I work at the moment. And while there is a long term plan to create a build script that deals with deployment at the

7条回答
  •  长情又很酷
    2021-01-22 06:39

    Here is a full breakdown of how I did it

    Create a blank text document in the root of your website called Version.txt.

    Create a second text document in the root of your website called Version.tmpl with the following contents

    Revision:   $WCREV$
    Repository: $WCURL$
    Modified:   $WCMODS?Yes:No$
    Built On:   $WCNOW$
    

    Right click on your website project and choose properties. Then go to the build events tab.

    Paste the following into your post build events:

    cd $(ProjectDir)
    "%ProgramFiles%\TortoiseSVN\bin\SubWCRev.exe" ..\. Version.tmpl Version.txt
    

    This will update the Version.txt file with some details about the working copy, using Version.tmpl as the template. The fact that Version.txt is now included in your website means that every time the website is deployed the Version.txt is also deployed and will contain useful information should you ever need to get your codebase back to the deployed version.

提交回复
热议问题