mparlak / Flee

Fast Lightweight Expression Evaluator
624 stars 119 forks source link

.Net Framework library including .Net Standard pulls in wrong Flee assembly #69

Open FrederickBrier opened 5 years ago

FrederickBrier commented 5 years ago

I have a .Net Standard library that uses Flee. It apparently pulls in assembly Flee.NetStandard20. Another of my libraries, which is Net472, depends on the first library. Compiling generates the following error:

Error   CS0012  The type 'ExpressionContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'Flee.NetStandard20, Version=1.0.0.0, Culture=neutral, PublicKeyToken=85238e57c1c34b81'.    Net472Library   D:\Projects\MyProject\Net472Library \ClassWithExpressionContextParameter.cs 22  Active

The Net472Library is linking with Flee.Net45 instead of Flee.NetStandard. The Net472Library.csproj includes the following line in the first <PropertyGroup> element:

    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

I am not sure how to force the Net472Library to use the Flee.NetStandard20, as you only specify "Flee" in the <PackageReference> element.

FrederickBrier commented 5 years ago

This is actually not a problem with Flee. Apparently is part of a larger issue with the .Net SDK. Unfortunately, it is an open issue. My workaround was to clone the Flee project and deleting the net45 project, updating the nuspec file to be "Flee.NetStandard", creating a new NuGet package, checking it into our local repo, and updating the .csproj files to specify the new package name.

One question is if you have a .Net Standard version of the library, why do you need the net45 version? Backward compatibility?

NetDefender commented 3 years ago

Hi, i had the similar problem an i did the following, I changed the csproj to force choosing the netstandard20 version and it worked:

`

..\..\packages\Flee.1.2.2\lib\netstandard20\Flee.NetStandard20.dll
</Reference>`