Creating a file with build number and branch name in SVN

后端 未结 7 994
醉话见心
醉话见心 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:31

    You can use this code get the information from vb. I use a rewritten version of this to find out this information at app startup time.

    http://www.codeproject.com/KB/architecture/svn_visual_studio.aspx

    0 讨论(0)
  • 2021-01-22 06:31

    I use ant as my build tool, so I have an ant target that stores the output of svnversion in the file svn-version. That target is a dependency of all the major entry points, so every time I run ant, svn-version is updated. I have the packaging operations include svn-version in all deliverable tar and zip files. So I can always look in svn-version to find out what version of code has been installed.

    Whatever build tool you are using, you should be able to do the same. if the data from svnversion isn't sufficient, you may want to add the output of svn info to the file as well.

    0 讨论(0)
  • 2021-01-22 06:33

    I also use Ant and have developed a special Task that is able to retrieve the Subversion information from a local repository (if the code was checked-out) or a remote Subversion server (if the code was exported) and makes them available via regular Ant properties.

    Using Ant replacement mechanism (in the Copy task, for example), you can place these values wherever you see fit.

    0 讨论(0)
  • svnversion is tool for checking current revisions of a working copy.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-01-22 06:44

    On Windows you have Subwcrev.

    0 讨论(0)
提交回复
热议问题