dotnet / dotnet/core

Using UI Automation without installing Desktop Runtime

Open
#4,714 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
22k
Forks
4.9k
Avg merge
5d 5h
Merged PRs (30d)
29

Description

Hi,
We need to use UI automation, and in order to run this code (just a simple example):

```
static void Main(string[] args)
{
AutomationElement currentProcessWindow =
AutomationElement.RootElement.FindAll(TreeScope.Children, Condition.TrueCondition)
.OfType()
.Single(a => a.Current.Name.Contains(Process.GetCurrentProcess().ProcessName));

Console.WriteLine(currentProcessWindow.Current.ControlType.ProgrammaticName);
}
```

we need to reference _Microsoft.WindowsDesktop.App.Wpf_:
```


Exe
netcoreapp3.1



```

This requires to install [Desktop Runtime](https://dotnet.microsoft.com/download/dotnet-core/thank-you/runtime-desktop-3.1.1-windows-x64-installer) on the machine.

Regardless of the reason, is there a way to use UI automation without having to install Desktop Runtime?

**Not sure that this is the right location for this. Tried also [here](https://github.com/dotnet/windows-desktop/issues/19), didn't get a response.**

Thanks.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.