LINQKit icon indicating copy to clipboard operation
LINQKit copied to clipboard

LinqKit.Core 1.2.5 is not compatible with net8.0

Open Fosol opened this issue 2 years ago • 17 comments

Doesn't appear the latest version is supported yet, even though you have create LinqKit.Microsoft.EntityFrameworkCore for 8.1.5.

error NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package LinqKit.Core 1.2.5 does not support any target frameworks.

Any update on when this might be enabled?

Fosol avatar Dec 05 '23 21:12 Fosol

It supports .NET Standard 2.1 image

So .NET should work ?

StefH avatar Dec 06 '23 09:12 StefH

All I know is that the compiler won't build in a net8.0 project.

Fosol avatar Dec 06 '23 12:12 Fosol

@Fosol When creating a default .NET 8 console app:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="LinqKit.Core" Version="1.2.5" />
  </ItemGroup>

</Project>

With this code:

using LinqKit;

namespace ConsoleAppLinqCore
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var predicate = PredicateBuilder.New<Program>(true);
        }
    }
}

The application compiles fine:

Rebuild started at 5:15 PM...
1>------ Rebuild All started: Project: ConsoleAppLinqCore, Configuration: Debug Any CPU ------
Restored C:\projects\ConsoleAppLinqCore\ConsoleAppLinqCore.csproj (in 14 ms).
1>ConsoleAppLinqCore -> C:\projects\ConsoleAppLinqCore\bin\Debug\net8.0\ConsoleAppLinqCore.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild completed at 5:15 PM and took 00.398 seconds ==========

And runs fine: image

StefH avatar Dec 07 '23 16:12 StefH

I tried LinqKit and LinqKit.Microsoft.EntityFrameworkCore, however both failed to compile.

I'll try LinqKit.Core and see if it works.

Fosol avatar Dec 07 '23 16:12 Fosol

Both LinqKit and LinqKit.Microsoft.EntityFrameworkCore can be used in a .NET 8 console app (I did some tests), however the LinqKit NuGet is not what you would want to use, because for backwards compatibility reasons, this package has a dependency on the old EntityFramwork version 6.x

StefH avatar Dec 08 '23 08:12 StefH

I don't know how you're getting it to work. When I build it fails with any of the libraries.

With LinqKit.Core <PackageReference Include="LinqKit.Core" Version="1.2.5" /> Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0)

With LinqKit <PackageReference Include="LinqKit" Version="1.2.5" /> Package LinqKit 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0)

With LinqKit.Microsoft.EntityFrameworkCore <PackageReference Include="LinqKit.Microsoft.EntityFrameworkCore" Version="8.1.5" /> Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0)

All are in projects with the following.

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>
...

Fosol avatar Dec 12 '23 15:12 Fosol

Are you using Visual Studio 2022 ?

StefH avatar Dec 12 '23 16:12 StefH

I'm using vscode.

dotnet --version = 8.0.100

Fosol avatar Dec 12 '23 16:12 Fosol

PS C:\projects\ConsoleAppLinqCore> dotnet --version
8.0.100

VSCode: image

StefH avatar Dec 13 '23 07:12 StefH

I have a new project

dotnet new console

Here is my test.csproj file.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="LinqKit" Version="1.2.5" />
  </ItemGroup>

</Project>

Here is the error on dotnet restore or dotnet build.

error NU1202: Package LinqKit 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package LinqKit 1.2.5 does not support any target frameworks.
error NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package LinqKit.Core 1.2.5 does not support any target frameworks.

I don't know why this doesn't work. I don't know what's different with my computer.

But that error is coming from somewhere.

image

Fosol avatar Dec 13 '23 13:12 Fosol

image

Fosol avatar Dec 13 '23 13:12 Fosol

You are using Linux or Apple or Windows?

StefH avatar Dec 13 '23 14:12 StefH

Windows 11 Enterprise

Fosol avatar Dec 13 '23 15:12 Fosol

Sorry, I cannot help you.

Adding a the package to an empty project gives this output for me:

PS C:\projects\ConsoleAppLinqCore> dotnet add package LinqKit.Core
  Determining projects to restore...
  Writing C:\Users\***\AppData\Local\Temp\tmpp20ar4.tmp
info : X.509 certificate chain validation will use the default trust store selected by .NET for code signing.
info : X.509 certificate chain validation will use the default trust store selected by .NET for timestamping.
info : Adding PackageReference for package 'LinqKit.Core' into project 'C:\projects\ConsoleAppLinqCore\ConsoleAppLinqCore.csproj'.
info :   GET https://api.nuget.org/v3/registration5-gz-semver2/linqkit.core/index.json
info :   OK https://api.nuget.org/v3/registration5-gz-semver2/linqkit.core/index.json 252ms
info : Restoring packages for C:\projects\ConsoleAppLinqCore\ConsoleAppLinqCore.csproj...
info :   GET https://api.nuget.org/v3/vulnerabilities/index.json
info :   OK https://api.nuget.org/v3/vulnerabilities/index.json 235ms
info :   GET https://api.nuget.org/v3/vulnerabilities/vulnerability.base.json
info :   GET https://api.nuget.org/v3/vulnerabilities/vulnerability.update.json
info :   OK https://api.nuget.org/v3/vulnerabilities/vulnerability.base.json 157ms
info :   OK https://api.nuget.org/v3/vulnerabilities/vulnerability.update.json 249ms
info : Package 'LinqKit.Core' is compatible with all the specified frameworks in project 'C:\projects\ConsoleAppLinqCore\ConsoleAppLinqCore.csproj'.
info : PackageReference for package 'LinqKit.Core' version '1.2.5' added to file 'C:\projects\ConsoleAppLinqCore\ConsoleAppLinqCore.csproj'.
info : Generating MSBuild file C:\projects\ConsoleAppLinqCore\obj\ConsoleAppLinqCore.csproj.nuget.g.props.
info : Generating MSBuild file C:\projects\ConsoleAppLinqCore\obj\ConsoleAppLinqCore.csproj.nuget.g.targets.
info : Writing assets file to disk. Path: C:\projects\ConsoleAppLinqCore\obj\project.assets.json
log  : Restored C:\projects\ConsoleAppLinqCore\ConsoleAppLinqCore.csproj (in 722 ms).

StefH avatar Dec 13 '23 16:12 StefH

Thanks for taking the time to look into it. I'll attempt it on another computer and see what happens. Perhaps I need to reinstall the SDK.

Fosol avatar Dec 13 '23 16:12 Fosol

@StefH can we reopen this ticket?

The following project file fails. with errors stating LinqKit 1.2.5 and LinqKit.Core 1.2.5 is not compatible with net8.0.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <RootNamespace>HSB.Test</RootNamespace>
    <Version>1.0.0.0</Version>
    <AssemblyVersion>1.0.0.0</AssemblyVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="DotNetEnv" Version="3.0.0" />
    <PackageReference Include="LinqKit" Version="1.2.5" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.6" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.6">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
  </ItemGroup>

  <ItemGroup>
    <Content Include="Migrations\**\*.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

</Project>

Fosol avatar Jun 12 '24 19:06 Fosol

The error disappears if I change to LinqKit 1.2.4, but I need to test the application to see if it works.

Fosol avatar Jun 12 '24 20:06 Fosol

This error still exists even when using LinqKit:1.3.0

error NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package LinqKit.Core 1.2.5 does not support any target frameworks.

<PackageReference Include="LinqKit" Version="1.3.0" />

Fosol avatar Sep 19 '24 03:09 Fosol

Essentially none of the versions of LinqKit work in with net8.0.

Fosol avatar Sep 19 '24 03:09 Fosol

$ dotnet add package LinqKit.Core
  Determining projects to restore...
  Writing C:\Users\user\AppData\Local\Temp\tmpcwvrnu.tmp
info : X.509 certificate chain validation will use the default trust store selected by .NET for code signing.
info : X.509 certificate chain validation will use the default trust store selected by .NET for timestamping.
info : Adding PackageReference for package 'LinqKit.Core' into project 'D:\SourceCode\fosol\pressav\src\libs\dal\PressAV.DAL.csproj'.
info :   GET https://api.nuget.org/v3/registration5-gz-semver2/linqkit.core/index.json
info :   OK https://api.nuget.org/v3/registration5-gz-semver2/linqkit.core/index.json 306ms
info : Restoring packages for D:\SourceCode\fosol\pressav\src\libs\dal\PressAV.DAL.csproj...
info :   CACHE https://api.nuget.org/v3/vulnerabilities/index.json
info :   CACHE https://api.nuget.org/v3-vulnerabilities/2024.09.17.23.34.11/vulnerability.base.json
info :   CACHE https://api.nuget.org/v3-vulnerabilities/2024.09.17.23.34.11/2024.09.18.17.34.13/vulnerability.update.json
error: NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0). Package LinqKit.Core 1.2.5 does not support any target frameworks.
error: NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0) / linux-arm. Package LinqKit.Core 1.2.5 does not support any target frameworks.
error: NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0) / linux-arm64. Package LinqKit.Core 1.2.5 does not support any target frameworks.
error: NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0) / linux-x64. Package LinqKit.Core 1.2.5 does not support any target frameworks.
error: NU1202: Package LinqKit.Core 1.2.5 is not compatible with net8.0 (.NETCoreApp,Version=v8.0) / win-x64. Package LinqKit.Core 1.2.5 does not support any target frameworks.
error: Package 'LinqKit.Core' is incompatible with 'all' frameworks in project 'D:\SourceCode\fosol\pressav\src\libs\dal\PressAV.DAL.csproj'.

Fosol avatar Sep 19 '24 03:09 Fosol

@Fosol Can you please provide an example project?

StefH avatar Sep 19 '24 06:09 StefH

Well the most amazing thing occurred today. After rebooting my system it worked... Here are the things I did over the last day that may have been related.

1st Possible Action

I was trying to resolve the above issues so I cleared nuget cache.

dotnet nuget locals all --clear

This didn't fix the issue. However, I didn't reboot after doing this.

2nd Possible Action

This is unlikely related, however it is something I was actively doing on my machine.

The Windows Security tools would not open. I looked around the internet how to fix it. I did everything that has been posted on the subject. Rebooted several times. Eventually I my Windows Security tools started working again.

And voila now today I am able to build with the latest version of LinqKit. After over a year of having this issue, it magically disappeared.

Fosol avatar Sep 19 '24 13:09 Fosol