The easiest way to add ClosedXML to your project is to install it using the NET CLI.
C:\source> dotnet add package ClosedXML
ClosedXML depends on the
SixLabors.Fonts library that is only available as a beta. The legacy
nuget dependency resolution ignores prerelease packages during installation, resulting in the following error:
Unable to resolve dependency 'SixLabors.Fonts'. Source(s) used: 'nuget.org', 'Microsoft Visual Studio Offline Packages'.
To solve the error, choose one of the possible solutions:
package.config has been deprecated for 5 year and
there is a full-fledged replacement that is better in every way that works on .NET Framework. If you
PackageReference style, the ClosedXML is installed without the error.
See Migrate from packages.config to PackageReference and related pages.
Install SixLabors.Fonts first
SixLabors.Fonts-beta18 package and then install ClosedXML package. This way, you can install the ClosedXML
even for the
package.config nuget restore.
Use prerelease switch
Open the Package Manager Console and specify the
-IncludePrerelease switch during installation.
PM> Install-Package ClosedXML -Version 0.97.0 -Verbose -IncludePrerelease
ClosedXML is a .NET Standard 2.0 library that runs on any compatible implementation (.NET Core 2.0+, .NET Framework 4.6.2, Blazor). ClosedXML doesn’t work on Unity due to Unity script engine.