How do I get just the Major
part of the version in AfterBuild target? I thought I could access the property like shown below, but it just echoes the statement rather than show version.
<Target Name="AfterBuild">
<GetAssemblyIdentity
AssemblyFiles="$(MyAssemblies)">
<Output
TaskParameter="Assemblies"
ItemName="MyAssemblyIdentities"/>
</GetAssemblyIdentity>
<Message Text="Files: %(MyAssemblyIdentities.Version.Major)"/>
</Target>
Here is the working code in Program.cs
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
Console.WriteLine(String.Format("My Application Version {0}", version.Major));