Partager via


F# Assembly Information File Template

So to round out the templates for a while, the final one I have created is an Item Template for creating an Assembly Information File:

image

The template can be found on the Visual Studio Gallery at:

https://visualstudiogallery.msdn.microsoft.com/06bc7a47-be14-42b9-a8cb-86031922ff83

The reason this one came about was due to the fact version 1.1 of the F# Windows Application templates now provide this capability.

This extension creates a file called AssemblyInfo.fs, that contains the standard assembly definitions usually associated with other programming languages. The generated code is as follows:

namespace FSharp.WinForms

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("FSharp.WinForms")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("Microsoft")>]
[<assembly: AssemblyProduct("FSharp.WinForms")>]
[<assembly: AssemblyCopyright("Copyright ? Microsoft 2011")>]
[<assembly: AssemblyTrademark("")>]

// 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("fbd3c25e-2afa-4c67-8be5-0575da04e77b")>]

// 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("1.0.0.0")>]
[<assembly: AssemblyFileVersion("1.0.0.0")>]

()

As all F# code files must do something, the final line is essentially the code that is executed. Remember, the added file cannot be the last source file in a project so it will have to be moved up the source file list.

Once this assembly information file is included in your project, you will be able to see the usual property definitions associated with the assembly:

image

Once again, hope this is useful.

Written by Carl Nolan