Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

728
Vistas
System.Management.Automation is incompatible with .NET Core 3.1

I want to write PowerShell in C#. There is a useful link from red-gate.com which describes the steps for the process. The author uses the .Net Framework as Class library project. I have no problems with that, however, I would like to write my functions also for .Net Core in order to make them also cross-platform functional. I created a new project with the target framework netcoreapp3.1. When I install System.Management.Automation 7.1.2 I get the error:

Error   NU1202  Package System.Management.Automation 7.1.2 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1). Package System.Management.Automation 7.1.2 supports: net5.0 (.NETCoreApp,Version=v5.0)

I am confused with the supported .NETCoreApp v5.0. With this link https://dotnet.microsoft.com/download there is .NET v5.0 and .NET Core 3.1. When I target net5.0 I get the error that the reference assemblies are not found but I installed the .NET 5.0 SDK.

C:\Users\Alex_P>dotnet --list-sdks
3.1.403 [C:\Program Files\dotnet\sdk]
5.0.201 [C:\Program Files\dotnet\sdk]

My question, how can I use System.Management.Automation in a .NET Core (cross-platform project) to write PowerShell functions?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Even though, unfortunately, the System.Management.Automation package's NuGet page doesn't mention it, this package is not meant to be used directly.

Instead, use one of the packages described in this answer, depending on your use case.

To target PowerShell (Core) 7+, use the Microsoft.PowerShell.SDK package.

  • To determine what specific .NET (Core) runtime a given package version must be combined with at a minimum, select the package version of interest on the linked page, expand the Dependencies section, and consult the first entry; e.g., for package version 7.1.3 the minimum required .NET (Core) runtime is net5.0
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda