本文介绍了未知的构建错误无法解析对 System.Windows 的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了 PoshConsole 的源代码并试图构建解决方案.我最初有两个问题 -

I just downloaded PoshConsole's source code and was trying to build the solution. I initially had two problem -

  1. 无法解析 System.Interactivity.dll.我安装了 Blend 4 SDK,该问题已解决.

  1. the System.Interactivity.dll could not be resolved. I installed Blend 4 SDK and that issue was fixed.

未知的构建错误 - 无法解析对 System.Windows 的依赖

Unknown build error - Cannot resolve dependency to System.Windows

现在,每当我尝试构建项目时,我都会在解决方案中的两个项目中遇到以下错误,并且经过一番谷歌搜索后我一直无法找到解决方案.

Right now, whenever I try to build the project, I get the following error in two projects in the solution and I haven't been able to find a solution after some googling around.

无法解析对程序集System.Windows"的依赖,版本=2.0.5.0,文化=中性,PublicKeyToken=7cec85d7bea7798e'因为它没有被预加载.使用 ReflectionOnly API 时,依赖程序集必须通过预加载或按需加载ReflectionOnlyAssemblyResolve 事件.

推荐答案

我收到了另一个(非 GAC、自定义)程序集的错误消息.

I have received this error message for another (non-GAC, custom) assembly.

就我而言,情况如下:

  • 程序集 X 包含 A 类
  • 程序集 Y 包含类 B,它继承自 A
  • 程序集 Z 包含一个用于 B 类的数据模板

Y 引用 X,Z 引用 Y.

Y referenced X, Z referenced Y.

错误信息指向Z中数据模板中引用B的那一行,指出X无法加载.

The error message was pointing to the line in the data template in Z where B was referenced, and pointed out that X could not be loaded.

解决方案是让 Z 也引用 X. 显然,编译器无法解析用于自行加载所需程序集的传递引用.

The solution was to have Z also reference X. Apparently, the compiler cannot resolve that transitive reference for loading the required assemblies on its own.

这篇关于未知的构建错误无法解析对 System.Windows 的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 08:48