找不到 System.Windows 程序集

发布于 2024-07-18 16:32:53 字数 395 浏览 4 评论 0原文

这是我们得到的错误:

错误 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

私藏温柔 2024-07-25 16:32:53

就我而言,没有可用的 System.Windows 参考。
我必须包含对 WindowsBase 的引用

In my case there was no System.Windows reference available to pick up.
I had to include a reference to WindowsBase

新雨望断虹 2024-07-25 16:32:53

添加程序集引用,就像添加任何其他框架程序集引用一样:

  • 右键单击项目
  • 选择“添加引用”
  • 选择左侧的 .NET 选项卡,然后在程序集列表中找到“System.Windows”
  • 双击在“System.Windows”上,并且将添加程序集引用

Add the assembly reference as you'd add any other framework assembly reference:

  • Right-click on the project
  • Select "Add reference"
  • Select the .NET tab on the left, and find "System.Windows" in the list of assemblies
  • Double-click on "System.Windows" and the assembly reference will be added
你另情深 2024-07-25 16:32:53

添加System.Windows程序集引用:

  • 右键单击项目
  • 选择“添加引用”
  • 选择左侧的.NET选项卡,在程序集列表中找到“System.Windows”
  • 双击“System.Windows”来添加它

如果这不能解决问题,请尝试添加 PresentationFrameworkPresentationCoreWindowsBase 程序集 (.NET 3.5)

Add System.Windows assembly reference:

  • Right-click on the project
  • Select "Add reference"
  • Select the .NET tab on the left, and find "System.Windows" in the list of assemblies
  • Double-click on "System.Windows" to add it

If this does not solve the issue try Adding PresentationFramework, PresentationCore and WindowsBase assemblies (.NET 3.5)

旧城烟雨 2024-07-25 16:32:53

我们发现它,我们必须进入 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!

稀香 2024-07-25 16:32:53

我以前在装有 VS 2010 的机器上也出现过这种情况。 由于某种原因,在添加引用窗口的.NET选项卡中找不到System.Windows程序集。 很奇怪。

在这种情况下,您只需转到浏览选项卡并导航至:

C:\Windows\Microsoft.NET\Assembly\GAC_MSIL\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:

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Windows\

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.

比忠 2024-07-25 16:32:53

右键单击“引用”文件夹,然后单击“添加引用”,然后选择 .NET 选项卡下的 System.Windows。

Right click on your "References" folder and click "Add Reference" and then select System.Windows under the .NET tab.

半城柳色半声笛 2024-07-25 16:32:53

我在中找到了所需的WindowsBase.dll

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0

I've found the needed WindowsBase.dll in

C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0

月依秋水 2024-07-25 16:32:53

好吧,它实际上是我的 wpf 应用程序中的 system.windows.presentation...

well, it was actually system.windows.presentation in my wpf app...

穿越时光隧道 2024-07-25 16:32:53

如果您的 .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.

旧夏天 2024-07-25 16:32:53

如果您使用的是 .NET Framework 2.0,请引用

系统.Windows.Forms

(并使用具有相同名称的命名空间)也可以完成这项工作

If you are using .NET Framework 2.0, referencing

System.Windows.Forms

(and using the namespace with the identical name) will do the job too

浅笑依然 2024-07-25 16:32:53

我遇到了同样的问题,但这是因为我们使用可移植类库而引起的,并且仅发生在某些 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.

花心好男孩 2024-07-25 16:32:53

在测试项目中添加与您正在测试的项目中看到的引用相同的引用。

我得到了这样的东西并添加了:

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.

赤濁 2024-07-25 16:32:53

您必须添加对项目的引用。 如果您使用的是 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...

笑脸一如从前 2024-07-25 16:32:53

You'll also run into this error if you use the Portable Library Tools as it's not supported.

岁月静好 2024-07-25 16:32:53

尝试添加PresentationCore.dll
之后您可以使用 System.Windows 命名空间

Try with adding PresentationCore.dll
After it you can use System.Windows namespace

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文