Can';t在C#Visual Studio中使用System.Management.Automation

Can';t在C#Visual Studio中使用System.Management.Automation,c#,C#,我在VisualStudio2019中制作了一个简单的C#控制台应用程序。 我想使用Automation.dll,所以我安装了自动化软件包 我坐在系统。管理。自动化使用,但它不工作 using System; using System.Collections; using System.Runtime.InteropServices; using System.Collections.ObjectModel; using System.Management; using System.Man

我在VisualStudio2019中制作了一个简单的C#控制台应用程序。 我想使用Automation.dll,所以我安装了自动化软件包

我坐在系统。管理。自动化使用,但它不工作

using System;
using System.Collections;
using System.Runtime.InteropServices;

using System.Collections.ObjectModel;
using System.Management;
using System.Management.Automation;
using System.Management.Automation.Runspaces;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
        }
    }
}
这是错误(翻译自德语)

CS0234命名空间“System.Management”中不存在类型或命名空间名称“Automation”。可能缺少程序集引用


该软件包是否确实安装在项目中?哪个版本?你在哪个框架上。NET Core 3.1?是的。v7.0.3。我可以在nuget包管理器中看到它。我使用的是.NETFramework 4.6.1。没有“核心”。这可能是问题所在吗?不完全确定,但看起来是这样。在“依赖项”下只有“.NETCoreApp 3.1”。。。所以我想,它只适用于Core 3.1