Skip to content

Commit 89e1ff1

Browse files
author
Michael Ganss
committed
Use assembly file version (fix #173)
1 parent df15158 commit 89e1ff1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

XmlSchemaClassGenerator.Console/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Collections.ObjectModel;
66
using System.IO;
77
using System.Linq;
8+
using System.Reflection;
89
using System.Text;
910
using System.Text.RegularExpressions;
1011
using System.Threading.Tasks;
@@ -177,7 +178,7 @@ static void ShowHelp(OptionSet p)
177178
{
178179
System.Console.WriteLine("Usage: dotnet xscgen [OPTIONS]+ xsdFile...");
179180
System.Console.WriteLine("Generate C# classes from XML Schema files.");
180-
System.Console.WriteLine("Version " + typeof(Generator).Assembly.GetName().Version);
181+
System.Console.WriteLine("Version " + typeof(Generator).Assembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version);
181182
System.Console.WriteLine(@"xsdFiles may contain globs, e.g. ""content\{schema,xsd}\**\*.xsd"", and URLs.");
182183
System.Console.WriteLine(@"Append - to option to disable it, e.g. --interface-.");
183184
System.Console.WriteLine();

XmlSchemaClassGenerator/VersionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static VersionProvider CreateFromAssembly()
2020
{
2121
var executingAssembly = Assembly.GetExecutingAssembly();
2222
var title = executingAssembly.GetCustomAttribute<AssemblyTitleAttribute>().Title;
23-
var version = executingAssembly.GetName().Version.ToString();
23+
var version = executingAssembly.GetCustomAttribute<AssemblyFileVersionAttribute>().Version;
2424

2525
return new VersionProvider(title, version);
2626
}

0 commit comments

Comments
 (0)