1

I'm trying to migrate a C# class library that I previously built which was targeting .NET Framework v4.5 to .NET Standard 2.0.

I tried many packages to include PowerShell support in my library but every time I include a package I get a warning saying that the package was included using a target framework different from the .NET Standard 2.0.

For example, with the System.Management.Automation_PowerShell_3.0` package I get the following error message

Le package 'System.Management.Automation_PowerShell_3.0 6.3.9600.17400' a été restauré en utilisant '.NETFramework,Version=v4.6.1' au lieu du framework cible du projet '.NETStandard,Version=v2.0'. Ce package n'est peut-être pas totalement compatible avec votre projet.

which would be roughly translated to English as

The package 'System.Management.Automation_PowerShell_3.0 6.3.9600.17400' was restored using '.NETFramework,Version=v4.6.1' instead of the projet's target framework '.NETStandard,Version=v2.0'. This package may not be completely compatible with the target project.

Since the main reason, I'm trying to port my library to .NET Standard is to support both the .NET Framework and the .NET Core targets, having a package one of the packages be .NET Framework-specific defeats the purpose of the port.

Do I have any workaround? Is there a PowerShell package that targets .NET Standard 2.0 that I missed (I tried about 10 PowerShell-related packaged in the VS17 NuGet explorer before posting here)?

For some background, I use PowerShell to run node.exe from my C# library.

5
  • Why do you need powershell to launch node.exe? Commented Oct 2, 2017 at 15:14
  • PowerShell for Linux isn't quite ready for prime time yet (6.0 isn't out of beta). Until it is, there's little point to making a .NET Standard package, since your code could only ever run on Windows anyway -- in which case having to run on the .NET Framework is no great impediment. If it does take off, it seems probable a .NET Standard package will be in the works, eventually. Even then you'd be requiring people to have PowerShell installed. Commented Oct 2, 2017 at 15:14
  • I couldn't figure any other way to start it ... Considering your question, I may have missed something about the different available options to run node ... Commented Oct 2, 2017 at 15:15
  • System.Diagnostics.Process IS available for standard at least according to accepted answer of stackoverflow.com/questions/44151911/… YMMV Commented Oct 2, 2017 at 15:18
  • oh .. oh ! node.**exe** ... IT'S AN EXECUTABLE sometimes i wonder why i ever was hired as developer ... -_- Thank you good sir Commented Oct 2, 2017 at 15:20

1 Answer 1

3

As far as I know there isn't any way around this. The reason for that is the package is built using the .NETFramework so until the creators port their package to the .NETStandard, it will only be usable from .NETFramework apps since, in theory, that package could use libraries that are not in the .NETStandard.

Sign up to request clarification or add additional context in comments.

1 Comment

But more than that a powershell wrapper is exactly something it makes little sense / may be impossible to port to .Net Standard, Powershell Core perhaps but not Windows Powershell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.