Closed doboczyakos closed 2 years ago
@sdanyliv please review and merge pull request https://github.com/scottksmith95/LINQKit/pull/159
If you change to package references. Then I doubt if building all NuGets with the same version in a single build process can work ...
These are project references:
`
` If you build all NuGets together they will be automatically converted to the appropriate package reference. Can you try it somehow?
@StefH, it works flawlessly, we have already tried it by simply building the solution in Visual Studio in release mode.
The LinqKit.EntityFramework => LinqKit.Core
, etc. project references have been perfectly converted to LinqKit.EntityFramework => LinqKit.Core
, etc. nuget package dependencies with the proper version coming from version.xml
's PatchVersion
.
LinqKit.EntityFramework.csproj
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../version.xml" />
<PropertyGroup>
<Version>1.1.$(PatchVersion)</Version>
[...]
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LinqKit.Core\LinqKit.Core.csproj" />
</ItemGroup>
</Project>
LinqKit.EntityFramework.nuspec
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>LinqKit.EntityFramework</id>
<version>1.1.28</version>
[...]
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="LinqKit.Core" version="1.1.28" exclude="Build,Analyzers" />
<dependency id="EntityFramework" version="6.2.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.1">
<dependency id="LinqKit.Core" version="1.1.28" exclude="Build,Analyzers" />
<dependency id="EntityFramework" version="6.3.0" exclude="Build,Analyzers" />
</group>
</dependencies>
[...]
</metadata>
</package>
We have the following packages: A library using LinqKit.Core A package using LinqKit, EF6 and the library Another package using LinqKit.EntityFrameworkCore, EF Core and the library
The problem is that both LinqKit and LinqKit.EntityFrameworkCore has the implementation of LinqKit.Core in the same namespace, so I cannot have (or inherit) package reference to both in the same project: Error CS0433 The type 'Linq' exists in both 'LinqKit.Core, Version=1.1.27.0, Culture=neutral, PublicKeyToken=bc217f8844052a91' and 'LinqKit.Microsoft.EntityFrameworkCore, Version=5.0.26.0, Culture=neutral, PublicKeyToken=a5e68054d5e7f94b'
If I make LinqKit.Core private in the library, I have the following runtime error: System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types. Could not load file or assembly 'LinqKit.Core, Version=1.1.26.0, Culture=neutral, PublicKeyToken=bc217f8844052a91'. The system cannot find the file specified.'
There are workarounds more or less working... but the correct way of reusing code is a package reference, so please exclude LinqKit.Core implementation from LinqKit.EntityFramework etc. projects, use ProjectReference converted to package dependency instead