I'm getting the following warning when I add the NuGet package to .NET Standard 2.1 library. I'm not sure if it will cause any issue when I use it in the .NET Core 3.1 app, but I thought you should be aware of it so that you may remove the warning message.
1>------ Rebuild All started: Project: MyProject, Configuration: Debug Any CPU ------
1>C:\Users\username\Source\github\repoowner\repo\src\MyProject\MyProject.csproj : warning NU1701: Package 'Microsoft.ClearScript 6.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.1'. This package may not be fully compatible with your project.
1>MyProject -> C:\Users\username\Source\github\repoowner\repo\src\MyProject\bin\Debug\netstandard2.1\MyProject.dll
1>Done building project "MyProject.csproj".
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
Hi @cilerler,
Please let us know if your application works on .NET Core 3.1 despite the warning.
Thanks!
Hi @ClearScriptLib
It does work as far as basic samples go; however, it causes ! on the dependency graph if you open it from the Visual Studio.
Here is a sample repository if you want to review it
@cilerler,
Thanks for posting the sample.
ClearScript doesn't support any version of .NET Standard. Even the latest release (.NET Standard 2.1) is missing critical APIs that ClearScript depends on, albeit mostly for JScript/VBScript rather than V8.
More importantly, we can't recommend referencing ClearScript directly from a .NET Standard library as your sample does. As the warning indicates, Visual Studio imports the .NET Framework version of ClearScript rather than the .NET Core version. This ends up causing your .NET Core test application to run in an unsupported hybrid environment that mixes .NET Core and .NET Framework components.
If your library must target .NET Standard, it might be able to use Activator or some other reflection-based mechanism to instantiate V8ScriptEngine safely.
Good luck!
I appreciate the quick and detailed feedback, would you mind keeping this request open, so we know once it supports it?
We'll be happy to leave it open for now. However:
Thanks!
I'm confused, if there will be no .NET Standard, are we going to create library classes as .NET Core? In another way, are you saying that the second repo, which is .NET Standard, should be a .NET Core repo?
That would solve my issue; however, I usually don't reference a .NET Core app from another .NET Core app.
I'm confused, if there will be no .NET Standard, are we going to create library classes as .NET Core?
A library can target any .NET runtime. .NET Standard is a "pseudo-runtime" that lets you build once and support them all, but the price you pay is that you can only use a common subset of their APIs.
The other price you pay is that your library can only _safely_ depend on other libraries that support .NET Standard. If a dependency only supports specific runtimes (like ClearScript does), NuGet picks one and issues the warning because it can't guarantee safety.
However, if your library is only used by apps under your control, and if you can validate those apps on the runtimes you care about, you can eliminate the warning by adding NoWarn to your reference:
<PackageReference Include="Microsoft.ClearScript" Version="6.0.0" NoWarn="NU1701"/>
In any case, it looks like .NET Core and .NET Framework will both be deprecated in favor of .NET 5. As for .NET Standard, nothing new has been announced, but it'll probably remain to facilitate support for older and third-party runtimes. What's unclear is whether .NET Standard will receive new updates.
In another way, are you saying that the second repo, which is .NET Standard, should be a .NET Core repo?
Yes. If you switch your library (MyClass) target from .NET Standard to .NET Core, there should no longer be an issue.
I really appreciate the details you provided, thank you 馃
Version 7.1.1 includes support for .NET Standard 2.1.
Thank you!

Most helpful comment
Version 7.1.1 includes support for .NET Standard 2.1.