SystemGuid.Keyboard 正在冻结我的程序

SystemGuid.Keyboard is freezing my Program

我有关注"Program"

static void Main(string[] args)
{
    Console.WriteLine("buh");

    System.Guid key = SystemGuid.Keyboard;

    Console.WriteLine("By");
    Console.ReadKey();
}

如果我设置线路,程序会冻结并且不会显示任何消息。 如果我不是从 Visual Studio 启动程序(只是 运行 exe)

我收到以下消息:

Unbehandelte Ausnahme: System.IO.FileLoadException: Die Assembly im gemischten Modus wurde während Version v1.1.4322 der Laufzeit erstellt und kann nicht während der 4.0-Laufzeit ohne zusätzliche Konfigurationsinformationen geladen werden. bei ConsoleApplication3.Program.Main(String[] args)

我该如何解决这个问题。

问题与您使用的引用 dll 的版本有关。只需右键单击您的项目,选择属性并将 .Net 版本更改为例如 3.5。或添加对最新版本 directx dll 的引用(如果存在)