33

I wanted to try out some of the automation stuff available through BugSlayer, but am having problems with the references.

I'm trying to figure out how to reference the System.Windows.Automation library in visual studio. I have the .NET Framework v3.5 installed, and VS 2008, but neither the UIAutomationClient nor System.Windows.Automation appear as a reference option in either the .NET or COM tabs for the references.

I can see the dll if I navigate to C:\WINDOWS\assembly\GAC_MSIL\UIAutomationClient\3.0.0.0__31bf3856ad364e35 through the command prompt, but if I browse to the assembly in Visual Studio, I can't actually get to the dlls.

Have I overlooked a simple way to include this in my project?

Graviton
  • 81,782
  • 146
  • 424
  • 602
tbischel
  • 6,337
  • 11
  • 51
  • 73

5 Answers5

61

The UIAutomationClient.dll is located in this folder:

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

If you can't find in your Add Reference->.Net tab, then you have to use the Browse tab to go to the given path, and add the assembly (Right Click on the References, choose add reference, click browse tab).

Graviton
  • 81,782
  • 146
  • 424
  • 602
  • that directory only has one dll on my system, not the one I was looking for. However the "en" folder contains an XML file for the UIAutomationClient. I was able to use a cmd window to manually copy the dll from the GAC to a place where I can access it... it seems to work doing that. I couldn't get at it using explorer though. – tbischel Sep 24 '09 at 18:15
  • In that case maybe you have to reinstall .net 3.5 and vs 2008 – Graviton Sep 25 '09 at 01:00
  • This didn't work for me (no such DLL in that folder), but the answer proved by @sharmila worked – Avrohom Yisroel May 31 '20 at 16:56
  • dotnet : `C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App\7.0.7\UIAutomationClient.dll` . Replace `7.0.7` with your preferred version of dotnet. – BurnsBA Jul 06 '23 at 14:59
18

add Uiautomationclient dll present under .net tab

sharmila
  • 181
  • 1
  • 2
10

I'm using Visual Studio Express 2015, and targeting to .NET 4.5. None of the answers worked for me. Here's what I had to do (after many minutes of looking through Add References -> Assemblies -> Framework and playing around. The reference I added is "UIAutomationClient". (There isn't any System.Windows.Automation" assembly in my list. Note that I also see assemblies "UIAutomationProvider", "UIAutomationTypes", and "UIAutomationClientsideProviders", but I didn't try any of those.)

Anyway, once I got the reference to "UIAutomationClient" added, then the using System.Windows.Automation actually worked okay.

Steve Greene
  • 490
  • 5
  • 10
2

For .Net coreapp 3.1, my fix is adding UseWPF into PropertyGroup of csproj file.

<UseWPF>true</UseWPF>

0

In VS 2015, you need to reference the UIAutomationProvider dll to use this Provider namespace. Just add a reference to this dll in your references folder. It's available in the Framework Assemblies of .NET.