Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

726
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda