简体   繁体   中英

How to set the Subversion revision number in Visual Studio build

I'd like to use the current Subversion revision number in my AssemblyFileVersion attribute to have this in the final complied dll.

I've used the MsBuild Community Task library from my deploy script to read the revision number and update the AssemblyInfo - this somewhat works, but ...

When I have an updated project and a current revsion number, say for example 100. I run the script and that will update the AssemblyInfo and a final dll with 100 as an attribute. When I then check these new AssemblyInfo files in I'll get a new revsion number (101).

The problem then is that if I see a dll with a specific revsion number and like to rebuild that dll the actual revsion I need is actually the one after the revsion numnber I see ...

How can this process be improved?

Is it possible to use RCS Keywords ?

One of the keywords is $Revision$ . This expands automatically to $Revision:xxx$ where xxx is the Subversion revision number every time you do a svn checkout or svn update .

You'll have to set the property svn:keywords on your Assembly file in order for this to work:

$ svn propset svn:keywords Revision Assembly.cs

I do this all the time, but for the build server that runs our continuous build software. That's takes a bit of setting up, but it will automatically build the software, set the correct version number, and even deploy the software every time someone does a commit.

By the way, I take it you're using AnkhSVN as your Subversion integration for VisualStudio.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM