Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7594171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:20:56+00:00 2026-05-30T21:20:56+00:00

All our projects in our SLN shares a VersionInfo.cs which holds the project version

  • 0

All our projects in our SLN shares a VersionInfo.cs which holds the project version number

[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]

I want to staticly define the 3 first parts of the version number and the last part i want to be the working copy SVN revision.

Step number one is to define a pre-build event in VS that triggers a cmd script, is there an easy way of getting the working copy revision from cmd?

Step number two is to insert that number into the VersionInfo.cs file

Theres probably more elegant ways of doing this, if you have one in store just keep in mind that this is a open source project and we do not have a fancy build server or anything like that. The deployment procedure is just put the project in release mode and build 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:20:58+00:00Added an answer on May 30, 2026 at 9:20 pm

    hmjd:s solution was only half there, if you write to the file every time you build all projects refering to the Versionfile needs to rebuild even if nothing has changed, I altered the script to only write to the file if its a new revision number

    @ECHO off
    
    FOR /F "tokens=1,2 delims=:M" %%A in ('svnversion ../ -c') do SET PART_1=%%A&SET PART_2=%%B
    
    SET file=../VersionInfo.cs
    
    IF NOT DEFINED PART_2 (
    SET SVN_REV=%PART_1%
    )
    
    IF NOT DEFINED SVN_REV (
    SET SVN_REV=%PART_2%
    )
    
    set result=0
    
    for /f "tokens=3" %%f in ('find /c /i ".%SVN_REV%." %file%') do set result=%%f
    
    IF %result% gtr 0 (
    GOTO end
    )
    
    ECHO using System.Reflection; > %file%
    ECHO [assembly: AssemblyVersion("0.1.%SVN_REV%.0")]     >>  %file%
    ECHO [assembly: AssemblyFileVersion("0.1.%SVN_REV%.0")] >> %file%
    
    :end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created an Engine which is basically used for all of our projects. Now
In our organization we have some projects which are (by policy) open to all
So we're gradually moving all our projects across into SVN, from CVS. One project
For a post-build step on our build server I want to get all projects
Let me describe a simple use-case: Running all tests in our project may take
We have a Library Project that we use for all our central reused code
We are building an ASP.NET project, and encapsulating all of our business logic in
We want to encrypt all our web app configuration files that we deploy to
We have for all our tests a method which starts a Jetty Server to
In my team, we put all our projects (only 7 large ones) in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.