I can't use libraries installed with paket tool

439 Views Asked by At

I can't open namespaces of libraries i added via paket and use them. If i try to build the project, the compiler complains with

error FS0039: The namespace 'bla bla' is not defined. [path of fsproj]

But i can clearly see them added in paket.dependencies, paket.references and paket.lock. So what is wrong ?

1

There are 1 best solutions below

1
buraky On

The problem might be caused because of paket's default framework restrictions and your dotnet version mismatch. For example; as of date 2021-12-27 and paket version 6.2.1 when you paket init, by default in paket.dependencies file there is this line:

framework: net5.0, netstandard2.0, netstandard2.1

If your dotnet version is 6.0, you can't use any library you added.

Solution is simple: just add net6.0 to that line.

framework: net6.0, net5.0, netstandard2.0, netstandard2.1

and then run

paket update
dotnet restore

(Running dotnet restore helps with your editor's linting). If there is no other problem, this should fix the situation.

Related Questions in F#