Assembly Information for F# Libraries

It’s standard practice for C# applications and assemblies to have metadata attached to the assembly specifying the version number, name, company, author, etc. Usually this information is specified in the Properties\AssemblyInfo.cs file.

However, F# libraries (by default) don’t have this assembly metadata, so you don’t know what version of a DLL you are looking at.  For example, without assembly information, MyLibrary looks like this in the Explorer window:


That’s not very helpful.

Thankfully, it’s very easy to add an AssemblyInfo.fs file to our F# library and achieve the same thing as a C# library.

Here’s the AssemblyInfo.fs file that you can copy/paste into your project.



open System.Reflection;

open System.Runtime.CompilerServices;

open System.Runtime.InteropServices;


// General Information about an assembly is controlled through the following

// set of attributes. Change these attribute values to modify the information

// associated with an assembly.

[<assembly: AssemblyTitle(“MyLibrary”)>]

[<assembly: AssemblyDescription(“”)>]

[<assembly: AssemblyConfiguration(“”)>]

[<assembly: AssemblyCompany(“Matt Valerio, Inc.”)>]

[<assembly: AssemblyProduct(“MyLibrary”)>]

[<assembly: AssemblyCopyright(“Copyright © Matt Valerio, Inc. 2008″)>]

[<assembly: AssemblyTrademark(“”)>]

[<assembly: AssemblyCulture(“”)>]


// Setting ComVisible to false makes the types in this assembly not visible

// to COM components.  If you need to access a type in this assembly from

// COM, set the ComVisible attribute to true on that type.

[<assembly: ComVisible(false)>]


// The following GUID is for the ID of the typelib if this project is exposed to COM

[<assembly: Guid(“c95f0dd1-9182-4d48-8bc2-b6cc2bca17bc5″)>]


// Version information for an assembly consists of the following four values:


//      Major Version

//      Minor Version

//      Build Number

//      Revision


// You can specify all the values or you can default the Build and Revision Numbers

// by using the ‘*’ as shown below:

// [assembly: AssemblyVersion(“1.0.*”)]

[<assembly: AssemblyVersion(“”)>]

[<assembly: AssemblyFileVersion(“”)>]


To use it, make AssemblyInfo.fs the last file in your F# Library (DLL) project (remember – file order is important for F# projects).  If necessary, right click on the file and use the “Move Up” and “Move Down” commands.

After compiling the F# Library, it will then have all of the usual CLR metadata compiled into the assembly and show up in the Explorer window correctly:


It is very important to note that the last line of AssemblyInfo.fs is “()”.  The file won’t compile without this, since attributes (even though they are assembly-level attributes) must be applied to something.  In this case, we’re applying all of the attributes to the “nothing” placeholder in F#, called “unit”, or “()”.

It would be nice if the F# templates that ship with the F# CTP included this file by default. I guess I could always make my own template :)

Hope that helps!

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

2 Responses to “Assembly Information for F# Libraries”

  1. […] Assembly Information for F# Libraries […]

  2. […] I finally bothered to look up how to add assembly information in F# […]

Leave a Reply