Bug 8578 - mcs should set file version info based on assembly attributes
Summary: mcs should set file version info based on assembly attributes
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2012-11-23 17:15 UTC by Harald van Dijk
Modified: 2013-05-17 20:19 UTC (History)
3 users (show)

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:

Description Harald van Dijk 2012-11-23 17:15:14 UTC

using System;
using System.Diagnostics;
using System.Reflection;
[assembly: AssemblyProduct("Hello, world!")]
static class Program {
  static void Main(string[] args) {

mcs test.cs -out:test.exe && mono test.exe

should print "Hello, world!", but doesn't. Instead, it prints " ". GetVersionInfo does return correct information for already built executables, but mcs isn't setting the version info fields for those it builds itself.

Tested with mono 3.0.1 and 3.0.0, not tested on older versions.
Comment 1 Harald van Dijk 2012-12-01 21:07:03 UTC
Forgot to mention, Microsoft's compiler does set the file version info, and at least one program (KeePass) doesn't work properly unless the file version info gets set, so this isn't just theoretical.

The code to set the version info is already there, but in such a way that it is not called:

mcs/class/IKVM.Reflection/Emit/AssemblyBuilder.cs contains:

// .NET doesn't support copying blob custom attributes into the version info
if (!cab.HasBlob)

If I replace that with


The generated file version info is correct. However, the comment strongly suggests this is the wrong approach.
Comment 2 David Lechner 2013-05-08 00:04:14 UTC
I'm here for the same reason. KeePass 2.x plugins (.plgx format) are broken because they expect the Assembly Product to be set to a specific value. Instead, I am getting the same " " from Comment #1.
Comment 3 Marek Safar 2013-05-09 04:10:06 UTC
Fixed in master
Comment 4 David Lechner 2013-05-17 20:19:45 UTC
I have confirmed that this fixes the issue I was experiencing with KeePass plugins. Thanks for fixing!