Paket icon indicating copy to clipboard operation
Paket copied to clipboard

Paket installed packages are not available for projects

Open 64J0 opened this issue 2 years ago • 8 comments

Description

I'm currently using Ubuntu 20.04, and I have the .NET SDK 6.0.101 installed. The Paket version that is installed in the project is the 6.2.1.

I have this project https://github.com/64J0/Fsharp-Kubernetes-Yaml-Gen where I'm trying to install Expecto using paket but for some reason, it is not working properly. I have followed all the steps in the Paket docs to start using this tool but it does not work.

$ dotnet new tool-manifest
$ dotnet tool install paket
$ dotnet paket init

$ dotnet paket add Expecto --version 9.0.4 --project ./Fsharp-K8s.Test/Test.fsproj
$ dotnet paket add Expecto.BenchmarkDotNet --version 9.0.4 --project ./Fsharp-K8s.Test/Test.fsproj
$ dotnet paket add Expecto.FsCheck --version 9.0.4 --project ./Fsharp-K8s.Test/Test.fsproj
$ dotnet paket add Expecto.Hopac --version 9.0.4 --project ./Fsharp-K8s.Test/Test.fsproj

$ dotnet tool restore
$ dotnet paket install
$ dotnet paket restore

Repro steps

  1. Close the repository https://github.com/64J0/Fsharp-Kubernetes-Yaml-Gen.
  2. Try to install the Paket dependencies.
  3. Try to build the project dotnet build.
  4. See the error messages.

Expected behavior

I was expecting that Paket would be able to add the packages I want to the projects I want.

Actual behavior

The project is not building because it can't find the Expecto files that should have been added by Paket to the project.

image

Known workarounds

If I install the package with nuget it works fine (except from some warnings related to conflicts):

$ dotnet add ./Fsharp-K8s.Test/Test.fsproj package Expecto --version 9.0.4

64J0 avatar Dec 24 '21 19:12 64J0

I changed the .fsproject to use the version 5.0 of dotnet and now the project is working fine with Paket. What should we do to make this project compatible with the latest version of dotnet?

64J0 avatar Dec 31 '21 01:12 64J0

Just saw right now that the integration with Dotnet 6 is still on alpha, so it is just a matter of time. Cool. https://github.com/fsprojects/Paket/blob/master/RELEASE_NOTES.md

64J0 avatar Dec 31 '21 01:12 64J0

Any news? Still not working when trying to use in a .NET 6 project to install Expecto.

64J0 avatar Jan 14 '22 19:01 64J0

The only thing I can see that might be wrong is when you change your .fsproj files to use <TargetFramework>net6.0</TargetFramework>, remember to also change framework: net5.0 to framework: net6.0 in paket.dependencies. Then run dotnet paket install && dotnet restore.

We use paket in dotnet 6 projects and it works as expected.

seanamos avatar Jan 18 '22 15:01 seanamos

Thanks for the response @seanamos, I think that I'm using the correct TargetFramework but not sure. I'll take a look to confirm soon. Btw, good call on this paket.dependencies.

64J0 avatar Jan 21 '22 12:01 64J0

I was also encountering this with paket 7.1.5. Interestingly, downgrading to 6.2.1 fixed it for me.

bromanko avatar Jul 07 '22 04:07 bromanko

We are using paket 7.1.3 (haven't tried 7.1.5 yet) with net6.0.

Project.csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
  </PropertyGroup>
  
  <Import Project="..\.paket\Paket.Restore.targets" />
</Project>

paket.references:

Serilog.AspNetCore

paket.dependencies:

storage: none
framework: net6.0
source https://api.nuget.org/v3/index.json

nuget Serilog.AspNetCore ~> 4
...
dotnet paket install && dotnet build

The reference works.

seanamos avatar Jul 07 '22 18:07 seanamos

after reading this thread I've just tried it with net6.0 and paket 7.2.0 like

dotnet new classlib -lang "F#" -f netstandard2.1 # has to match paket.dependencies
dotnet new globaljson --sdk-version 6.0.111 # because net7 isnt' compatible with my desired libs atm
dotnet new tool-manifest
dotnet tool install paket
dotnet paket init
dotnet paket add sutil # and open it in Library.fs
dotnet build # succeeds

The key point for me was that dotnet build has to be executed first for the language server to pick up the dependency which is kinda counter intuitive

hesxenon avatar Dec 01 '22 17:12 hesxenon