How to add System.Windows dll to Visual Studio 201

2019-07-21 06:11发布

问题:

I am developing a small application using C# and VS2010 as IDE with .NET Framework 4.

I want to use CaptureSource class in order to capture video from laptop's webcam.
For that i need to add a namespace System.Windows.DependencyObject.

How can I add this? In the Solution Explorer, if I right clicked on Referenced, then .NET tab, I wont be able to see System.Windows. Please see the attached file the same.

Please anyone help me in adding this System.Windows dll.

Thanks in Advance
Sri

回答1:

According to this MSDN Page the class is in the WindowsBase.dll file.

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

DependencyObject is a class you cannot add it as a namespace. The closest thing you can do is add the namespace it is located in:

using System.Windows;


回答2:

You can browse dll in your local system to add reference. If you can not get any file with the name System.Windows.dll then you can download dll from following link and then add reference of that downloaded dll. click here to download dll



回答3:

Can't speak for VS2010, but a few years have passed and I just had this issue in VS2013.

In Visual Studio 2013, I did "Add Reference", and found "WindowsBase" near the bottom of Assemblies/Framework. I added that, and was able to add using System.Windows to files in the project. "Resolve" appeared on the context menu for DependencyObject, DependencyProperty, etc.



回答4:

I don't think that you need to add the System.Windows reference. If you look at this site: https://docs.microsoft.com/en-us/dotnet/api/system.windows.dependencyobject?view=netframework-4.7.1 then you'll see that the assembly (dll) you actually need is one called WindowBase. This should be found by right-clickling "References" in your project, select "Add References" and then in the "Framework" tab select WindowsBase in the bottom of the list.

If you do this your IDE will automatically include the System.Windows namespace when you resolve (right-click on the DepedencyObject) and press "DepdendecnyObject - using system.windows".

I reproduced your situation and this worked fine for me.

Best Regards, Adam