There are several options to define the assembly information of an .NET Core app in F#:
.fsproj
fileDirectory.Build.props
file- When running
dotnet build
ordotnet publish
:-p:Version=a.b.c.d
The information of the .fsproj
file seems to have priority over Directory.Build.props
file. You can place the Directory.Build.props
file in the project folder or the solution folder.
.fsproj file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>1.0.0.0</Version>
<FileVersion>1.0.0.0</FileVersion>
<Product>MyApp</Product>
<Copyright>Copyright © 2020 by myself</Copyright>
</PropertyGroup>
<ItemGroup>
...
Directory.Build.props file
<Project>
<PropertyGroup>
<Version>1.0.0.0</Version>
<FileVersion>1.0.0.0</FileVersion>
<Product>MyApp</Product>
<Copyright>Copyright © 2020 by myself</Copyright>
</PropertyGroup>
</Project>
Check the assembly version
The simple way
- Run:
cat MyApp.dll
- Check the last lines. They contain the assembly information
The convenient way
Install the versioninfo tool and run it on the .dll:
dotnet tool install --global dotnet-versioninfo
versioninfo MyApp.dll