找不到 System.Windows 程序集
这是我们得到的错误:
错误 1 类型“System.Windows.Point”是在未引用的程序集中定义的。 您必须添加对程序集“System.Windows,Version=2.0.5.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e”的引用。 C:\PacMan\PacMan\PacMan\PacManTests\UnitTest1.cs 65 13 PacManTests
我们在单元测试项目中遇到此错误,无法找到 System.Windows 程序集,但我们的主项目可以找到该程序集并正常运行。
有谁对我们可以在哪里或如何引用 System.Windows 来解决此问题有任何意见或建议?
This is the error we get:
Error 1 The type 'System.Windows.Point' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. C:\PacMan\PacMan\PacMan\PacManTests\UnitTest1.cs 65 13 PacManTests
We get this error in our unit test project which cant find the System.Windows Assembly but our main project can find the assembly and run it fine.
Does anyone have any input or advice on where or how we can reference System.Windows to fix this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
就我而言,没有可用的 System.Windows 参考。
我必须包含对 WindowsBase 的引用
In my case there was no System.Windows reference available to pick up.
I had to include a reference to WindowsBase
添加程序集引用,就像添加任何其他框架程序集引用一样:
Add the assembly reference as you'd add any other framework assembly reference:
添加
System.Windows
程序集引用:如果这不能解决问题,请尝试添加
PresentationFramework
、PresentationCore
和WindowsBase
程序集 (.NET 3.5)
Add
System.Windows
assembly reference:If this does not solve the issue try Adding
PresentationFramework
,PresentationCore
andWindowsBase
assemblies (.NET 3.5
)我们发现它,我们必须进入 Silverlight 文件夹并找到 System.Windows.dll,现在一切都很好,感谢您的帮助!
We found it we had to go into the Silverlight folder and found the System.Windows.dll and now all is good thanks for the help though!
我以前在装有 VS 2010 的机器上也出现过这种情况。 由于某种原因,在添加引用窗口的.NET选项卡中找不到System.Windows程序集。 很奇怪。
在这种情况下,您只需转到浏览选项卡并导航至:
到达那里后,选择正确的版本子文件夹(应类似于...
v4.0_4.0.0.0__b03f5f7f11d50a3a
),然后在那里选择 System.Windows.dll。I had this occur on a machine with VS 2010 once before. For some reason, the System.Windows assembly was not found in the .NET tab of Add Reference window. Very strange.
In this case, you will just have to go to the Browse tab and navigate to:
Once there, select the proper version subfolder (should look something like...
v4.0_4.0.0.0__b03f5f7f11d50a3a
) and then choose the System.Windows.dll there.右键单击“引用”文件夹,然后单击“添加引用”,然后选择 .NET 选项卡下的 System.Windows。
Right click on your "References" folder and click "Add Reference" and then select System.Windows under the .NET tab.
我在中找到了所需的WindowsBase.dll
I've found the needed WindowsBase.dll in
好吧,它实际上是我的 wpf 应用程序中的 system.windows.presentation...
well, it was actually system.windows.presentation in my wpf app...
如果您的 .NET 引用中没有 System.Windows,请尝试 WindowsBase。 这修复了我对 VS 2008 中 System.Windows.Point 的引用。
If you don't have System.Windows in your .NET references, try WindowsBase. That fixed my reference to System.Windows.Point in VS 2008.
如果您使用的是 .NET Framework 2.0,请引用
(并使用具有相同名称的命名空间)也可以完成这项工作
If you are using .NET Framework 2.0, referencing
(and using the namespace with the identical name) will do the job too
我遇到了同样的问题,但这是因为我们使用可移植类库而引起的,并且仅发生在某些 PC 安装上。
我发现这些安装中的问题已通过以下方式修复:
http:// /www.microsoft.com/en-us/download/details.aspx?id=3556
由于此修复包含在 VS2010 和 Windows Update 中,因此仅会在某些 PC 上发生。
I had the same problem, however it was caused because we are using a Portable Class library and only occurred on certain PC installations.
I found the issue to be fixed on these installation with:
http://www.microsoft.com/en-us/download/details.aspx?id=3556
As this fix is included with VS2010 and Windows Update it would only occur on certain PCs.
在测试项目中添加与您正在测试的项目中看到的引用相同的引用。
我得到了这样的东西并添加了:
PresentationCore
演示框架
WindowsBase
现在似乎保持安静。
Add the same references in your test project as you see as references in the project you are testing.
I got something like this and added:
PresentationCore
PresentationFramework
WindowsBase
Now it seems to stay quiet.
您必须添加对项目的引用。 如果您使用的是 Visual Studio,请在解决方案资源管理器中右键单击该项目,然后选择“添加引用...”
You have to add the reference to the project. If you're using Visual Studio, right-click the project in the Solution Explorer, and choose Add Reference...
如果您使用便携式库工具<,您也会遇到此错误/a> 因为它不受支持。
You'll also run into this error if you use the Portable Library Tools as it's not supported.
尝试添加PresentationCore.dll
之后您可以使用 System.Windows 命名空间
Try with adding PresentationCore.dll
After it you can use System.Windows namespace