Skip to content
This repository was archived by the owner on Jun 20, 2025. It is now read-only.
This repository was archived by the owner on Jun 20, 2025. It is now read-only.

Using UI Automation without installing Desktop Runtime #19

@Jasdo

Description

@Jasdo

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<AutomationElement>()
          .Single(a => a.Current.Name.Contains(Process.GetCurrentProcess().ProcessName));

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

we need to reference Microsoft.WindowsDesktop.App.Wpf:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <FrameworkReference Include="Microsoft.WindowsDesktop.App.Wpf" />
  </ItemGroup>

</Project>

This requires to install Desktop Runtime on the machine.

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

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions