fsprojects / Paket

A dependency manager for .NET with support for NuGet packages and Git repositories.
https://fsprojects.github.io/Paket/
MIT License
2.02k stars 525 forks source link

Paket installs packages for net5 but dependencies specifies framework netcoreapp3.1 #3978

Open MarneeDear opened 3 years ago

MarneeDear commented 3 years ago

Description

I have an asp.net core app (netcore 3.1). I am trying to install packages with paket. I only want it to install the packages that are compatible with netcoreapp3.1 but it is installing the latest which only work with net5.0.

This causes the app to fail to build due to incompatibility with certain packages. I have tried to specify the version in my dependencies file but I have had to do this for 6 packages so far and I am afraid I will have to do this with tons of them.

Is there a way I can tell paket to only use packages compatible with netcoreapp3.1? Am I doing something wrong?

This is the dependencies file. The ones I have commented out were the packages I had to add explicitly with a version specified.

framework: netcoreapp3.1, netstandard2.0, netstandard2.1
source https://api.nuget.org/v3/index.json
storage: none

nuget FSharp.Core
nuget FSharp.Data
nuget FSharp.Data.SqlClient
nuget Saturn
nuget Giraffe
//https://github.com/serilog/serilog-aspnetcore
nuget Serilog.AspNetCore
nuget Serilog.Sinks.Console
nuget Serilog.Sinks.File
nuget AWS.Logger.AspNetCore
nuget AWS.Logger.SeriLog
nuget AWSSDK.SecretsManager
nuget Expecto
nuget Thoth.Json.Net
nuget Microsoft.NET.Test.Sdk
nuget Expecto.FsCheck
nuget Expecto.TestResults
nuget SendGrid
nuget TaskBuilder.fs
nuget System.Configuration.ConfigurationManager
//nuget Microsoft.Extensions.Configuration.UserSecrets
//nuget Microsoft.VisualStudio.Web.CodeGeneration.Design
//nuget Microsoft.VisualStudio.Web.CodeGeneration
nuget Otp.NET
//nuget Microsoft.AspNetCore.Authentication.JwtBearer < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGenerators.Mvc < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGeneration.Core < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGeneration.Templating < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGeneration.Design < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGeneration < 5.0
//nuget Microsoft.VisualStudio.Web.CodeGeneration.Utils < 5.0

group Build
  source https://api.nuget.org/v3/index.json
  framework: netstandard2.0

  nuget AWSSDK.SecretsManager
  nuget FSharp.Core = 4.5.0 // https://github.com/fsharp/FAKE/issues/2001
  nuget Fake.Core.Target
  nuget Fake.DotNet.Cli
  nuget Fake.IO.FileSystem
  nuget Fake.Core.Environment
  nuget Fake.Core.Trace
  nuget Fake.IO.Zip  
  nuget NuGet.CommandLine

This is an example of the error I get:

C:\Users\marnee\Documents\mister\application\mister-admin\src\WebHost\WebHost.fsproj : error NU1202: Package Microsoft.AspNetCore.Authentication.JwtBearer 5.0.1 is not compatible with netcoreapp3.1

Project file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
:
:

Paket version:

marnee@DESKTOP-R85TMON C:\Users\marnee\Documents\mister\application\mister-admin
$ dotnet paket --version
Paket version 5.257.0
qiuhaotc commented 3 years ago

In this case, you need to pin the nuget packages to specific version, like

nuget Otp.NET ~> 3.0.0
MarneeDear commented 3 years ago

Yes, I understand. That is why I said this in my original issue report:

I have tried to specify the version in my dependencies file but I have had to do this for 6 packages so far and I am afraid I will have to do this with tons of them.

MiloszKrajewski commented 3 years ago

I think this is the same thing as I raised quite some time ago. Unfortunately not solved: https://github.com/fsprojects/Paket/issues/2818

ModernRonin commented 3 years ago

I got the same issue - at some point after net5 release I ran paket update and it happily updated, everything compiled, the tests ran, so I thought: no problem.

Until I tried to run the project and got issues at runtime about tons of net5 assemblies.