0

I'm trying to get the assembly file verison within a Silverlight application. Since Silverlight doesn't have the FileVersionInfo class, this seems to be the recommended way to get the information:

var executingAssembly = Assembly.GetExecutingAssembly();
var customAttributes = executingAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
if (customAttributes != null)
{
    var assemblyFileVersionAttribute = customAttributes[0] as AssemblyFileVersionAttribute;
    return assemblyFileVersionAttribute.Version;
}

However, the above code returns 1.2.0.*. That is indeed what is in the AssemblyInfo.cs file, but I want the actual file version (without the asterisk) instead of 1.2.0.*. How can I do that?

Community
  • 1
  • 1
Bob Horn
  • 33,387
  • 34
  • 113
  • 219

1 Answers1

0

The problem here is that AssemblyFileVersion does not auto-increment like AssemblyVersion does. The * in your assembly.cs file is actually part of the AssemblyFileVersion string. See this answer for more.

Community
  • 1
  • 1
kmort
  • 2,848
  • 2
  • 32
  • 54