我第一次尝试编写 Windows Media Center 插件。
该插件将使用外部程序集zeroconfignetservices。我构建了项目,一切都正确编译。但是,当我在媒体中心运行应用程序时,事件查看器中会出现以下错误。
Exception System.IO.FileNotFoundException: Could not load file or assembly 'ZeroconfService, Version=0.6.0.0, Culture=neutral, PublicKeyToken=1df4e21661f2383d' or one of its dependencies. The system cannot find the file specified.
但是程序集是在 GAC 中加载的。输出gacutil /l zeroconfservice
:
Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.17929
Copyright (c) Microsoft Corporation. All rights reserved.
The Global Assembly Cache contains the following assemblies:
zeroconfservice, Version=0.6.0.0, Culture=neutral, PublicKeyToken=1df4e21661f2
383d, processorArchitecture=x86
Number of items = 1
我还尝试将 ZeroconfService.dll 的副本放在与媒体中心插件相同的目录中。
我还需要做什么才能让媒体中心插件看到程序集?
为了彻底,在编译代码时有一个警告。我通常不是 .Net 开发人员,也不了解警告的细微差别。也许这是相关的?
warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "ZeroconfService", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.