-
Notifications
You must be signed in to change notification settings - Fork 0
FAQ
Simply follow the example in the README
Using paket
Add the Fornax.Seo NuGet package to your paket.dependencies
file.
Make sure the generate_load_scripts
option is set to true
, e.g.
# paket.dependencies
source https://api.nuget.org/v3/index.json
framework: net8.0, netstandard2.0, netstandard2.1
generate_load_scripts: true
storage: none
# . . .
nuget Fornax.Seo
nuget Markdig
# . . .
Run dotnet paket install
, then load the Fornax.Seo.fsx
helper script to expose the Fornax.Seo
namespace, e.g.
// loaders/globalloader.fsx
#load @"../.paket/load/net8.0/Fornax.Seo.fsx"
open Fornax.Seo
// . . .
Note
Installing Fornax.Seo 1.2.0 or later will also generate a Fornax.Core.fsx
load script.
This is not the case with versions of Fornax.Seo before 1.2.0.
Fornax 0.14.0 and later supports NuGet package references, e.g.
// loaders/globalloader.fsx
#r "nuget: Fornax.Seo"
open Fornax.Seo
// . . .
Since Fornax 0.14.2, the Fornax.Core assembly is not interchangeable
Fornax versions prior to 0.14.0 target the .NET Core 3.1 runtime, which means:
-
Fornax.Seo can't be referenced as a NuGet package (a feature introduced in .NET 5)
-
your scripts must reference the file path to
Fornax.Seo.dll
on disk, like so:// loaders/globalloader.fsx #r "../_lib/Fornax.Core.dll" #r "../_lib/Fornax.Seo.dll"
Warning
fornax new
will raise an unhandled exception if run inside an existing project
To keep Fornax.Core.dll
out of version control, use MSBuild to copy all referenced assemblies to a local folder inside your project, like so:
-
Create a
*.fsproj
file at the root of your project -
Reference a compatible version of the package, e.g.:
<Project Sdk="Microsoft.NET.Sdk"> <!-- --> <ItemGroup> <PackageReference Include="Fornax.Seo" Version="1.0.0" /> <PackageReference Include="Markdig" Version="0.24.0" /> </ItemGroup> </Project>
-
Make sure the
CopyLocalLockFileAssemblies
property is set totrue
:<Project Sdk="Microsoft.NET.Sdk"> <!-- --> <PropertyGroup> <!-- --> <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> </PropertyGroup> </Project>
-
When you run
dotnet build
, all referenced assemblies will appear in the $(OutputPath) directory. For example, runningdotnet build -o _lib
will populate
_lib
like so:├── FSharp.Core.dll ├── FSharp.Data.DesignTime.dll ├── FSharp.Data.dll ├── Fornax.Core.dll ├── Fornax.Seo.dll ├── Markdig.dll ├── Newtonsoft.Json.dll ├── . . . └── . . .
Important
-
The $(OutputPath) directory should be wherever fornax will look for assemblies
-
Make sure fornax is ignoring build artifacts, like the
obj
andbin
directories, e.g.// config.fsx let staticPredicate (_, page: string) = page.Contains "_public" || page.Contains "bin" || // <-- important page.Contains "obj" // <-- important
That depends on your Fornax version and how you intend to reference the package assemblies. The following is a general guide.
Assembly reference mode | Supported versions | |
---|---|---|
Fornax | Fornax.Seo | |
#load ".paket/load/$(TFM)/Fornax.Seo.fsx" |
* | * |
#r "nuget: Fornax.Seo" |
>= 0.14.0 | * |
#r "local/file/path/to/Fornax.Seo.dll" |
0.13.1 – 0.14.1 | 1.0.0 |
Notes
- Fornax.Seo 1.0.0 was the last version to support assembly file path referencing
- Fornax versions earlier than 0.13.1 have not been tested for compatibility