缺少System.WindowsSystem、Windows

2023-09-04 04:47:45 作者:傾城笑、笑壹世繁華。

我和里面的一些Silverlight和WPF项目,以及一些类库和其他的东西相当大的解决方案。

I have a rather large solution with some Silverlight and WPF projects inside it, as well as some class libraries and other things.

其中一个项目是一个类库引用一个Silverlight应用程序,它引用 System.Windows

One of the project is a class library that references a SilverLight application which references System.Windows

但在运行时,我得到的错误:

But at runtime, I get the error:

{无法加载文件或程序集'System.Windows,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e'或一个依赖项,系统找不到指定的文件。 :System.Windows,版本= 2.0.5.0,文化=中性公钥= 7cec85d7bea7798e}

我看着在GAC( C:\ WINDOWS \组装)并且不可能看到它在那里...

I looked in the GAC (C:\Windows\assembly) and couldnt see it in there...

在这里发生的请告诉我?

Whats happening here?

基准是: C:\ Program Files文件\参考大会\微软\框架\ Silverlight的\ V4.0 \ System.Windows.dll中这确实存在

推荐答案

声音,我喜欢你的WPF应用程序加载类库引用了Silverlight的程序集。这不能工作,猫,狗。如果一个组件由既是一个WPF和Silverlight应用程序中引用那么它必须与不同的框架组件参照编了两次。这需要两个项目。保持WPF和Silverlight的东西分开在不同的解决方案是保持摆脱困境的最佳途径。

Sounds to me like your WPF app is loading a class library that references a Silverlight assembly. That cannot work, cats and dogs. If an assembly is referenced by both a WPF and a Silverlight app then it has to be compiled twice with different framework assembly references. That takes two projects. Keeping the WPF and the Silverlight stuff separate in different solutions is the best way to keep out of trouble.