sklose/NCalc2

Namespace Error (Serializable)

Closed this issue · 4 comments

I cannot add [Serializable] to any class because the compiler can't decide if it wants to use NCalc or NetStandard.

The Error-Message says something like this (translated):

"SerializableAttribute" is present in
"NCalc, Version=3.5.0.2, Culture=neutral, PublicKeyToken=null" and
"netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"

Does anyone have any idea how to fix this?

It seems this is an issue with net-standard 1.6.1 and 2.0 (MarimerLLC/cslaforum#336) could you please add a net-standard 2.0 version of ncalc to nuget?

I think this is due to this file https://github.com/sklose/NCalc2/blob/master/src/NCalc/Antlr/PCLExtensions/PCLExtensions.cs ... in order to get ANTLR to compile for netstandard1.3 I had to fake the Serializable attribute for it. It should be easy to fix by adding a new build target for netstandard2.0 and exclude that file from compilation there.

I pushed out a new version, take a look if that fixes your problem (v2.2.34)

Compile errors are gone and it seems to be running good.
Thanks.