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.
// 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: AssemblyCompany("Matt Valerio, Inc.")>]
[<assembly: AssemblyCopyright("Copyright © Matt Valerio, Inc. 2008")>]
// 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.
// The following GUID is for the ID of the typelib if this project is exposed to COM
// Version information for an assembly consists of the following four values:
// Major Version
// Minor Version
// Build Number
// 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.*")]
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!