Automatic version increment on a C# program?

Posted on 2007-08-04
Last Modified: 2013-12-17
I have a web service I'd like to deploy and would like to remotely check the version number.  But I do not want to take the risk that I forgot to increment some value before deployment.  I want to be certain that a new version arrived and was deployed.

Is therea build number or some other unique value (or string) that the program can reference and return when I create a Getersion() web method?

Question by:newbieweb
    LVL 18

    Accepted Solution

    See this article. Note you have AssemblyInfo.cs in your project.
    How to auto-increment assembly version using a custom MSBuild task
    The assembly version string has the format, such as 2.0.50727.42.  Here is a sample on how to create a custom MSBuild task for Web Deployment Projects  to auto-increment the build and revision portion of your version strings with each build.

    Another idea I use is to use the datestamp from the web site's dll which is the last compile date/time.

                DateTime timestamp = System.IO.File.GetCreationTime("your.dll");

    Gary Davis
    LVL 37

    Assisted Solution

    generally you do want to version a webservice like this. generally you want to only 'publicly' chane versions when you have a material change to the contract (as thats all the client really cares about)

    Author Comment


    Maybe I'll have a public version like you say, but a private version as well, so I can be sure that multiple servers running the same web service in fact have the same build.


    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now