I'm working on a console application using .NET Core 8 and I need to use the AutomationElement
object from the UIAutomation library to automate UI tasks.
I've used AutomationElement
in .NET Framework applications before, but I'm facing issues using it in a .NET Core 8 console application. I'm not sure which packages to install or how to reference the necessary assemblies.
Environment details:
I tried installing various UIAutomation-related NuGet packages, but none seem to provide the AutomationElement
class for .NET Core 8. I've also looked for any documentation or examples specific to .NET Core but haven't found anything helpful.
You can't find it because the AutomationElement
is part of the System.Windows.Automation
namespace, and that namespace/class is not compatible with or available in .NET 8. This is taken from the page for that class in the .NET API Browser:
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
You'll need to look into a different UI automation library that is compatible with .NET 8.
(By the way, it's not called .NET Core 8. It's just .NET 8. Core is obsolete now, despite the name appearing in other frameworks like EntityFramework Core. If you've been searching using the word "Core" you might have been limiting your results.)