Bug 38553

Summary: FileVersionInfo.ProductVersion is not populated from AssemblyVersion
Product: [Mono] Compilers Reporter: Hin-Tak Leung <htl10>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: ---   
Hardware: Other   
OS: Linux   
Tags: Is this bug a regression?: ---
Last known good build:

Description Hin-Tak Leung 2016-02-08 20:31:37 UTC
Split off from bug 38515 comment 2:

I have another binary built with Microsoft visual c#. Comparing with it, I think I found another bug. There seems to be two bugs relating to this, one to do with the mono c# compiler and the other to do with the mono runtime:

- the mono compiler does not copy AssemblyVersion into System.Diagnostics.FileVersionInfo, the Microsoft compiler does.
Comment 1 Marek Safar 2016-02-09 15:31:44 UTC
I cannot reproduce it.

using System.Reflection;
using System.Diagnostics;
using System;

[assembly: AssemblyVersion("2011.04.0.0")]

class X
{
    public static int Main()
    {
        Assembly executingAssembly = Assembly.GetAssembly(typeof(X));
        FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(executingAssembly.Location);
        Console.WriteLine(fvi);

        return 0;
    }
}


works for me
Comment 2 Hin-Tak Leung 2016-02-10 04:55:31 UTC
Does not work correctly here:

$ cat > 1.cs
using System.Reflection;
using System.Diagnostics;
using System;

[assembly: AssemblyVersion("2011.04.0.0")]

class X
{
    public static int Main()
    {
        Assembly executingAssembly = Assembly.GetAssembly(typeof(X));
        FileVersionInfo fvi =
FileVersionInfo.GetVersionInfo(executingAssembly.Location);
        Console.WriteLine(fvi);

        return 0;
    }
}
^D

$ mcs 1.cs

$ mono 1.exe
File:             /home/Hin-Tak/1.exe
InternalName:     1
OriginalFilename: 1.exe
FileVersion:      2011.4.0.0
FileDescription:   
Product:           
ProductVersion:    
Debug:            False
Patched:          False
PreRelease:       False
PrivateBuild:     False
SpecialBuild:     False
Language          Invariant Language (Invariant Country)

$ mcs --version
Mono C# compiler version 4.0.5.0

Note 'ProductVersion' empty above.

What version of mcs are you running?
Comment 3 Hin-Tak Leung 2016-02-14 21:42:33 UTC
I upgraded to 4.2.2 and the issue persists. I thought things might differ since system.diagnostics was replaced in 4.2 by Microsoft's version, but there is no improvement. What version are you using? Dev head?
Comment 4 Marek Safar 2016-02-15 11:36:26 UTC
Fixed in master