Automatic build number tracking in VS 2005?

Is there an easy way in Visual Studio 2005 to automatically increase the build / build numbers of files after a successful build?

Emphasis on lightweight . I would like to track my build version without having to install CruiseControl or any similar tool.

+1


source to share


3 answers


You can use this project and include it in your .proj file

This url might be helpful Updating Porj Build Number



This didn't suit my needs and I decided to add this as build.proj which works with the cure

<?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build"  
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> <PropertyGroup>
    <Major>1</Major>
    <Minor>0</Minor>
    <Build>0</Build>
    <Revision>0</Revision>   </PropertyGroup>   <PropertyGroup>
    <BuildDir>C:\svn\Infrastructure</BuildDir> </PropertyGroup>

  <ItemGroup>
    <SolutionsToBuild Include="Infrastructure.sln"/>   </ItemGroup>

  <Target Name="Build" DependsOnTargets="ChangeDataAccessAssemblyInfo">
    <RemoveDir Directories="$(BuildDir)\Builds" Condition="Exists('$(BuildDir)\Builds')" />
    <MSBuild Projects="@(SolutionsToBuild)" Properties="Configuration=Debug" Targets="Rebuild" />   </Target>

  <ItemGroup>
    <TestAssemblies Include="Build\Logging\Logging.UnitTests.dll" />   </ItemGroup>



  <Target Name="ChangeDataAccessAssemblyInfo" >
    <Message Text="Writing ChangeDataAccessAssemblyInfo file for 1"/>
    <Message Text="Will update $(BuildDir)\DataAccess\My Project\AssemblyInfo.vb" />
    <AssemblyInfo CodeLanguage="VB"
       OutputFile="$(BuildDir)\DataAccess\My Project\AssemblyInfo_new.vb"          

       AssemblyTitle="Data Access Layer"
       AssemblyDescription="Message1"
       AssemblyCompany="http://somewebiste"
       AssemblyProduct="the project"
       AssemblyCopyright="Copyright notice"
       ComVisible="true"
       CLSCompliant="true"
       Guid="hjhjhkoi-9898989"
       AssemblyVersion="$(Major).$(Minor).1.1"
       AssemblyFileVersion="$(Major).$(Minor).5.7"
       Condition="$(Revision) != '0' "
       ContinueOnError="false" />

    <Message Text="Updated Assembly File Info" 
             ContinueOnError="false"/>   </Target>   </Project>

      

+2


source


Publish options might be what you want ... (for available C #, not sure if in C ++).



In studio, right-click the project file and open Properties, then select the Publish tab. There is an option to automatically increase the number of revisions.

+1


source


How about writing a small macro that increments the version?

Or how about this VS AddIn ?

0


source







All Articles