1

Closed

Null Reference Exception when no Pinned Version

description

Not sure if anyone contributes here or not, this is the first post.  I've been using this project for awhile and had some suggestions or maybe they are problems with the way I am using the tool.  Here are my observations.
 
1.  Latest version has a bug in the code: In VersionUpdater.cs, options.PinVersion is null throws an exception, need to wrap:
 
// if pin version build number is invalid
if (options.PinVersion != null)
{
    if (options.PinVersion.Build == -1)
        calculator.BuildNumberType = options.BuildNumberType;
   else 
        calculator.BuildNumberType = BuildNumberType.Fixed;
}
 
  1. When using this utility, what is the best practice for updating a source tree.  I've looked at the samples and don't see a sample for running this with a build system.  It would be nice to use this in conjunction with MSBuild to update a group of files.   Something like this:
     
    <PropertyGroup>
    <AssemblyInfoSpec>AssemblyInfo.cs</AssemblyInfoSpec>
    </PropertyGroup>
     
<!-- Set the AssemblyInfoFiles items dynamically --> <CreateItem Include="$(SolutionRoot)**\$(AssemblyInfoSpec)">
    <Output ItemName="AssemblyInfoFiles" TaskParameter="Include" />
</CreateItem>
<Exec WorkingDirectory="$(SolutionRoot)\Sage" Command="UpdateVersion.exe -b $(AssemblyInfoFiles)" />
</Target>

 
 

 
 

 
 
 
This would allow the developer a way to update all the AssemblyInfo files in a directory Hierarchy in one fell swoop.  The only alternative to this that I see is having to run Pre-Build Events like:
 
"$(OutDir)UpdateVersion.exe" -p 1.1.0.0 -b BuildDay -r Fixed -v Assembly -i $(ProjectDir)Properties\AssemblyInfo.cs -o $(ProjectDir)Properties\AssemblyInfox.cs
"$(OutDir)UpdateVersion.exe" -p 1.1.0.0 -b BuildDay -r Fixed -v File -i $(ProjectDir)Properties\AssemblyInfox.cs -o $(ProjectDir)Properties\AssemblyInfo.cs
 
I don't see a way around calling this twice as the Input can't be the same as the Output.  Wouldn't this be the normal use case however, to simply Update the AssemblyInfo files?
Thanks
Closed Oct 26, 2009 at 6:22 AM by flanakin
Fixed in 1.3.1

comments