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:So I changed it to...
//
// 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")]
[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 unhandledApparently, CommonAppDataPath doesn't look at the built version number, it looks at the text in AssemblyInfo.cs. That's just great!
Message=Illegal characters in path.
Source=mscorlib
StackTrace:
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
Dearest Microsoft. Please don't tease us with these 'features' that aren't.
The real solution to this would be twofold.
- Make the CommonAppDataPath read the App version as built during the last compile.
- 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:
Post a Comment