VersionNumber.targets SkipVersioning

Aug 2, 2011 at 6:30 PM

Is it possible to set SkipVersioning=true in a propertyGroup? I am trying to set this to true based on a condition to not have VersionNumber.targets touch the AssemblyInfo.cs files.

When I do the following the VersionNumber.targets is still modifying the AssemblyInfo.cs file but with the default FileBuild and FileRevsion types.  I have tried using a Condition and set the File types to be NoIncrement which does what I would like to do but the VersionNumber.targets still touches the AssemblyInfo.cs file.  Am I using the SkipVersioning correctly or is there another way to do this?

   <PropertyGroup>
     <AssemblyMajorVersion>2</AssemblyMajorVersion>
     <AssemblyMinorVersion>0</AssemblyMinorVersion>
     <AssemblyBuildNumber>0</AssemblyBuildNumber>
     <AssemblyRevision>0</AssemblyRevision>
     <AssemblyBuildNumberType>NoIncrement</AssemblyBuildNumberType>
     <AssemblyBuildNumberFormat></AssemblyBuildNumberFormat>
     <AssemblyRevisionType>NoIncrement</AssemblyRevisionType>
     <AssemblyRevisionFormat></AssemblyRevisionFormat>
   </PropertyGroup>

   <!-- Properties for controlling the Assembly File Version -->
   <PropertyGroup Condition="'$(VersionBump)' == 'BUMP'">
     <AssemblyFileMajorVersion>$(AssemblyMajorVersion)</AssemblyFileMajorVersion>
     <AssemblyFileMinorVersion>$(AssemblyMinorVersion)</AssemblyFileMinorVersion>
     <AssemblyFileBuildNumber></AssemblyFileBuildNumber>
     <AssemblyFileRevision></AssemblyFileRevision>
     <AssemblyFileBuildNumberType>AutoIncrement</AssemblyFileBuildNumberType>
     <AssemblyFileBuildNumberFormat>000</AssemblyFileBuildNumberFormat>
     <AssemblyFileRevisionType>AutoIncrement</AssemblyFileRevisionType>
     <AssemblyFileRevisionFormat>000</AssemblyFileRevisionFormat>
   </PropertyGroup>

   <!-- Properties for controlling the Assembly File Version -->
   <PropertyGroup Condition="'$(VersionBump)' == ''">
     <SkipVersioning>true</SkipVersioning>
   </PropertyGroup>
   

Aug 2, 2011 at 6:36 PM

currently I have opted to move my Condition attribute to the <Imports to not import any of the VersionNumber.targets script when the condition is false.

Coordinator
Aug 11, 2011 at 8:18 PM

Hi

I'd expect it to work. I'll try repro and see what is happening.

Mike