Note that last time I asked this question it was wrongly closed as a duplicate of this question which does not answer my question.
I have a C# program for .NET Core. I am retrieving the assembly version using:
<TextBlock xmlns:ref = "clr-namespace:System.Reflection;assembly=mscorlib">
<TextBlock.Text>
<Binding Path="Version">
<Binding.Source>
<ObjectDataProvider MethodName="GetName">
<ObjectDataProvider.ObjectInstance>
<ObjectDataProvider MethodName="GetExecutingAssembly" ObjectType="{x:Type ref:Assembly}" />
</ObjectDataProvider.ObjectInstance>
</ObjectDataProvider>
</Binding.Source>
</Binding>
</TextBlock.Text>
</TextBlock>
I don't have the assembly version defined in AssemblyInfo.cs
, but in Properties | Package I have Assembly Version, Package Version, and Assembly File Version all set to 1.0.0.0. The program is showing the version as 4.0.0.0. Where is it getting that version number? Is there any way to change that version number? (I assume I could override it in AssemblyInfo.cs
- not tried that yet, but I don't like the idea of two potentially conflicting version numbers floating around.)
Note that the suggested existing answer does not answer my question, because the file that answer references contains the version number I have specified (1.0.0.0), not the surprising 4.0.0.0 the program is finding, so it is not the source of the version number and is not the answer to my question.