ASE Home Page Products Download Purchase Support About ASE
ChartDirector General
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Creating libraries for .Net Core & .Net Framework
Posted by David Thielen on Feb-21-2020 00:47
Hi Peter;

This is off-topic but since you've done this, I'm hoping you can answer. (I asked on StackOverflow and just got lectures on publish via NuGet).

We, like you ship a commercial library (ours is 5 DLLs, not one). And to complicate it a bit more, one is create via IKVM.

My first question is - what's the best way to build our DLLs? Is it to build a single DLL that runs on both Core & Framework? Or do we compile the solution twice, once for Core and once for Framework?

And if it's twice, do you have a framework ChartDirector.Net.dll file? Or for framework are we back to netchartdir.dll?

My second question is - what do we do about framework only code? If we build distinct DLLs, that's easy. We do conditional #if in the source. But if it's a single DLL for both, what then? So far we have 3 small methods that are framework only (in core they won't be called).

thanks - dave

  Re: Creating libraries for .Net Core & .Net Framework
Posted by Peter Kwan on Feb-21-2020 03:35
Hi David,

If your code and all dependent DLLs are using a subset of the .NET API called ".NET Standard", then it is possible for one DLL to work in both .NET Core and .NET Framework. This is achieved by setting the "Target Framework" in "Project/Properties" to ".NET Standard 2.0".

If your full code cannot compile for ".NET Standard 2.0", it means your code or other dependent DLLs are using .NET Core specific API or .NET Framework specific API. In this case, you can only compile two DLLs.

The "ChartDirector.Net.dll" is build based on the ".NET Standard 2.0", so it works in both .NET Core 2.0 or later and .NET Framework 4.6.1 or later. That means no matter your build one DLL or two DLLs for your code, you can always use the same "ChartDirector.Net.dll" for all cases.

We also have a "netchartdir.dll" that contains some .NET Framework specific features, but from your previous message, it seems you do not need those features. So for your case, using "ChartDirector.Net.dll" for both .NET Core and .NET Framework should be fine.

Peter Kwan

  Re: Creating libraries for .Net Core & .Net Framework
Posted by David Thielen on Feb-21-2020 03:36
Thank you!

- best