Global constants in F# - how to

Viewed 7423

I need to set a version number to be used in the AssemblyVersion attribute by several related projects.

In C# I use the following

public class Constants {
    public const string Version = "1.2.3.4";
}

then it can be used as follows:

[assembly:AssemblyVersion(Constants.Version)]

What would be the equivalent construct in F#. All my attempts to come up with a binding which can be accepted as an attribute argument did not work.

2 Answers

Use the attribute Literal:

[<Literal>] 
let version = "1.2.3.4"

[<assembly:AssemblyVersion(version)>]
Related