Can not find System.Windows Assembly

2019-02-05 18:04发布

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?

15条回答
Viruses.
2楼-- · 2019-02-05 18:41

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!

查看更多
爷、活的狠高调
3楼-- · 2019-02-05 18:44

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

查看更多
SAY GOODBYE
4楼-- · 2019-02-05 18:49

If you don't have System.Windows in your .NET references, try WindowsBase. That fixed my reference to System.Windows.Point in VS 2008.

查看更多
太酷不给撩
5楼-- · 2019-02-05 18:51

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)

查看更多
孤傲高冷的网名
6楼-- · 2019-02-05 18:52

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

查看更多
\"骚年 ilove
7楼-- · 2019-02-05 18:55

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.

查看更多
登录 后发表回答