1

我希望System.ServiceProcess.ServiceController在 .NET Standard 2.0 项目中使用该类。为此,我从 NuGet 下载了 Microsoft.Windows.Compatibility 数据包,其中包括其他内容(我还尝试自己简单地下载 System.ServiceProcess.ServiceController 数据包)。我现在可以在课堂上毫无问题地使用 ServiceController,但是当我尝试运行程序时,我得到:

System.IO.FileNotFoundException: Could not load file or assembly 'System.ServiceProcess.ServiceController, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

我想我在这里遗漏了一些重要的东西,特别是因为据我所知,我安装的版本是 4.5.0,而它正在寻找的版本是 4.2.1.0。我究竟做错了什么?

4

0 回答 0