Pages

Tuesday, August 30, 2011

Version Number Fail

So...
I'm building a Windows desktop application and noticed that the version number (after 50+ builds) is 1.0.0.0.  So I looked for "Auto increment assembly version and came across this great article.
Ok.
So if you open /Properties/AssemblyInfo.cs you see the following lines...

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
So I changed it to...
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]

And what happened?  Well for one, it causes this line (elsewhere in my code) to FAIL.
string path = Application.CommonAppDataPath;
...thows the error:
System.ArgumentException was unhandled
  Message=Illegal characters in path.
  Source=mscorlib
  StackTrace:
       at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
Apparently, CommonAppDataPath doesn't look at the built version number, it looks at the text in AssemblyInfo.cs.  That's just great! 

Dearest Microsoft.  Please don't tease us with these 'features' that aren't.

The real solution to this would be twofold.
  1. Make the CommonAppDataPath read the App version as built during the last compile.
  2. Make another AppDataPath that does not include the version.


Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

No comments:

Share This!

Contact Us

Name

Email *

Message *