How to programmatically change a project's product version?

后端 未结 11 1300
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 12:02

I have several deployment projects. In order to deploy an application, I need to do several tasks, one of them is to change each deployment project\'s product version and pr

相关标签:
11条回答
  • 2020-12-09 12:41

    This may not be quite what you're after, but way back in the mists of time I wrote something called stampver, which can auto-increment a build number directly in the .exe file as a post-build step.

    0 讨论(0)
  • 2020-12-09 12:42

    Look into the use of RCS, CVS and/or subversion. I am only familiar with RCS; my understanding is that CVS is based on RCS but more comprehensive. I have read on various boards that subversion is the better, but I have never used it. RCS has been adequate for keeping track of changes and versions on all my documents and software projects.

    RCS is here: http://www.cs.purdue.edu/homes/trinkle/RCS/

    CVS is here: http://www.nongnu.org/cvs/

    Subversion is here: http://subversion.tigris.org/

    0 讨论(0)
  • I was searching for the exact same thing today. I found this using google:

    static void Main(string[] args) 
    {
        string setupFileName = @"<Replace the path to vdproj file>"; 
        StreamReader reader = File.OpenText(setupFileName); 
        string file = string.Empty; 
    
        try 
        { 
            Regex expression = new Regex(@"(?:\""ProductCode\"" = 
            \""8.){([\d\w-]+)}"); 
            Regex expression1 = new Regex(@"(?:\""UpgradeCode\"" = 
            \""8.){([\d\w-]+)}"); 
            file = reader.ReadToEnd(); 
    
            file = expression.Replace(file, "\"ProductCode\" = \"8:{" + 
            Guid.NewGuid().ToString().ToUpper() + "}"); 
            file = expression1.Replace(file, "\"UpgradeCode\" = \"8:{" 
            + Guid.NewGuid().ToString().ToUpper() + "}"); 
        } 
        finally 
        { 
            // Close the file otherwise the compile may not work 
            reader.Close(); 
        } 
    
        TextWriter tw = new StreamWriter(setupFileName); 
        try 
        { 
            tw.Write(file); 
        } 
        finally 
        { 
            // close the stream 
            tw.Close(); 
        } 
     }
    
    0 讨论(0)
  • Embedding SVN Revision number at compile time in a Windows app

    In my answer to this question, I describe how I accomplish this task using SVN.

    0 讨论(0)
  • 2020-12-09 12:50

    Do it from within a batch file?

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