Bug 38553 - FileVersionInfo.ProductVersion is not populated from AssemblyVersion
Summary: FileVersionInfo.ProductVersion is not populated from AssemblyVersion
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 4.0.0
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-02-08 20:31 UTC by Hin-Tak Leung
Modified: 2016-02-15 11:36 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

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