Build versioning: How to keep revision unmodified

Sep 17, 2009 at 3:56 PM

I am using MSBuild.ExtensionPack.VersionNumber.targets to update my daily build number.  However, I prefer not to change the revision number (last portion of the version string).  Instead I like to keep it unmodified and only change the third part as "mmdd".  How can I do this?

Thanks a lot.

Coordinator
Sep 18, 2009 at 8:18 AM

Hi, looking at the docs, I think you can pass in AssemblyFileRevision="0" AssemblyRevisionType="NoIncrement". Can't try it right now, but let me know if that doesn't work for you and I'll investigate further.

Mike

Sep 19, 2009 at 9:50 PM

Thanks a lot. That worked.  One follow up question.  For the 3rd field we use mmdd format.  The local time is picked, instead of UTC.  I.e. depending on timezone where build happens, either 0919 or 0920 shows up, as an example.  Is there a way to tell it to use UTC?  Thanks!

Coordinator
Sep 20, 2009 at 4:50 PM

UseUtc="true" :-)

 

Sep 20, 2009 at 5:30 PM

Thanks. That seems easy. However, when I set this property closest where it is used (in MSBuild.ExtensionPack.VersionNumber.targets, red highlight below) it still creates 0920 (instead of 0921 as of 10AM PST).

<Target Name="UpdateAssemblyInfoFiles"
            Inputs="$(MSBuildAllProjects);
                @(Compile);
                @(ManifestResourceWithNoCulture);
                $(ApplicationIcon);
                $(AssemblyOriginatorKeyFile);
                @(ManifestNonResxWithNoCultureOnDisk);
                @(ReferencePath);
                @(CompiledLicenseFile);
                @(EmbeddedDocumentation);
                @(CustomAdditionalCompileInputs);
                @(AssemblyInfoFiles)"
            Outputs="@(AssemblyInfoFiles);@(IntermediateAssembly)">
        <AssemblyInfo AssemblyInfoFiles="@(AssemblyInfoFiles)"
                      AssemblyMajorVersion="$(AssemblyMajorVersion)"
                      AssemblyMinorVersion="$(AssemblyMinorVersion)"
                      AssemblyBuildNumber="$(AssemblyBuildNumber)"
                      AssemblyRevision="$(AssemblyRevision)"
                      AssemblyBuildNumberType="$(AssemblyBuildNumberType)"
                      AssemblyBuildNumberFormat="$(AssemblyBuildNumberFormat)"
                      AssemblyRevisionType="$(AssemblyRevisionType)"
                      AssemblyRevisionFormat="$(AssemblyRevisionFormat)"
                      AssemblyFileMajorVersion="$(AssemblyFileMajorVersion)"
                      AssemblyFileMinorVersion="$(AssemblyFileMinorVersion)"
                      AssemblyFileBuildNumber="$(AssemblyFileBuildNumber)"
                      AssemblyFileRevision="$(AssemblyFileRevision)"
                      AssemblyFileBuildNumberType="$(AssemblyFileBuildNumberType)"
                      AssemblyFileBuildNumberFormat="$(AssemblyFileBuildNumberFormat)"
                      AssemblyFileRevisionType="$(AssemblyFileRevisionType)"
                      AssemblyFileRevisionFormat="$(AssemblyFileRevisionFormat)"
                      ComVisible="$(AssemblyComVisible)"
                      AssemblyGuid="$(AssemblyGuid)"
                      AssemblyCompany="$(AssemblyCompany)"
                      AssemblyConfiguration="$(AssemblyConfiguration)"
                      AssemblyCopyright="$(AssemblyCopyright)"
                      AssemblyCulture="$(AssemblyCulture)"
                      AssemblyDescription="$(AssemblyDescription)"
                      AssemblyProduct="$(AssemblyProduct)"
                      AssemblyTitle="$(AssemblyTitle)"
                      AssemblyIncludeSigningInformation="$(AssemblyIncludeSigningInformation)"
                      AssemblyDelaySign="$(AssemblyDelaySign)"
                      AssemblyKeyFile="$(AssemblyKeyFile)"
                      AssemblyKeyName="$(AssemblyKeyName)"
                      UseUtc="true">

 

 

Coordinator
Sep 20, 2009 at 6:41 PM

Interesting. Can you give me the values you are using for

 

AssemblyFileMajorVersion="$(AssemblyFileMajorVersion)"
                      AssemblyFileMinorVersion="$(AssemblyFileMinorVersion)"
                      AssemblyFileBuildNumber="$(AssemblyFileBuildNumber)"
                      AssemblyFileRevision="$(AssemblyFileRevision)"
                      AssemblyFileBuildNumberType="$(AssemblyFileBuildNumberType)"
                      AssemblyFileBuildNumberFormat="$(AssemblyFileBuildNumberFormat)"
                      AssemblyFileRevisionType="$(AssemblyFileRevisionType)"
                      AssemblyFileRevisionFormat="$(AssemblyFileRevisionFormat)"

 

or even better, a /v:diag log output of all your properties being used.

 

thanks

Mike

Sep 20, 2009 at 6:57 PM

Initial Properties:
__COMPAT_LAYER                 = ElevateCreateProcess
_AfterCompileWinFXInternalDependsOn =
        PrepareResourcesForSatelliteAssemblies;
        MergeLocalizationDirectives;
        AfterCompileWinFX
   
_CompileTargetNameForLocalType = _CompileTemporaryAssembly
_DebugSymbolsProduced          = true
_DeploymentApplicationManifestIdentity = Native.Common
_DeploymentBuiltUpdateInterval = 0
_DeploymentBuiltUpdateIntervalUnits = Days
_DeploymentDeployManifestIdentity = Common.application
_DeploymentFileMappingExtension =
_DeploymentTargetApplicationManifestFileName = Native.Common.manifest
_DeploymentUrl                 =
_DocumentationFileProduced     = false
_GetChildProjectCopyToOutputDirectoryItems = true
_OriginalConfiguration         = Debug
_OriginalPlatform              = AnyCPU
_RequireMCPass2ForMainAssembly = false
_RequireMCPass2ForSatelliteAssemblyOnly = false
_ResolveReferenceDependencies  = true
_ResourceNameInMainAssembly    = Common.g.resources
AllowedReferenceAssemblyFileExtensions =
            .exe;
            .dll
       
AllowedReferenceRelatedFileExtensions =
            .pdb;
            .xml
       
AllowUnsafeBlocks              = true

AssemblyAttributeClsCompliant  = false
AssemblyBuildNumber            =
AssemblyBuildNumberFormat      = MMdd
AssemblyBuildNumberType        = DateString
AssemblyCompany                =
AssemblyComVisible             =
AssemblyConfiguration          =
AssemblyCopyright              =
AssemblyCulture                =
AssemblyDelaySign              = false
AssemblyDescription            =
AssemblyFileBuildNumber        =
AssemblyFileBuildNumberFormat  = MMdd
AssemblyFileBuildNumberType    = DateString
AssemblyFileMajorVersion       = 1
AssemblyFileMinorVersion       = 0
AssemblyFileRevision           = 0
AssemblyFileRevisionFormat     = DateFormat
AssemblyFileRevisionType       = NoIncrement
AssemblyFoldersSuffix          = AssemblyFoldersEx
AssemblyGuid                   =
AssemblyIncludeSigningInformation = false
AssemblyKeyFile                =
AssemblyKeyName                =
AssemblyMajorVersion           = 1
AssemblyMinorVersion           = 0
AssemblyName                   = Common
AssemblyProduct                =
AssemblyRevision               = 0
AssemblyRevisionFormat         = DateFormat
AssemblyRevisionType           = NoIncrement
AssemblySearchPaths            =
            {CandidateAssemblyFiles};
            ;
            {HintPathFromItem};
            {TargetFrameworkDirectory};
            {Registry:Software\Microsoft\.NetFramework,v3.5,AssemblyFoldersEx};
            {AssemblyFolders};
            {GAC};
            {RawFileName};
            C:\Users\Foo\Depots\Bar\main\Drop\Debug\bin\
       
AssemblyTitle                  =
AssignTargetPathsDependsOn     =
AutoUnifyAssemblyReferences    = true

Sep 21, 2009 at 1:14 AM

Ignore my previous comment.  It does work.  I mixed up time zones in my test.

Thank you again.

Coordinator
Sep 21, 2009 at 8:06 AM

Great!