Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UIAutomationClient.dll not found #3283

Closed
ms0713 opened this issue Aug 30, 2019 · 13 comments
Closed

UIAutomationClient.dll not found #3283

ms0713 opened this issue Aug 30, 2019 · 13 comments

Comments

@ms0713
Copy link

ms0713 commented Aug 30, 2019

Issue Title

UIAutomationClient.dll is not found in Reference Assemblies folder for .Net Core 3.0 Preview

General

I want to use System.Windows.Automation in my .Net Core 3.0 console application. When I try to reference UIAutomationClient.dll, i did not find the same in Reference Assemblies folder for .Net Core 3.0. Rather UIAutomationClient.xml is available on following folder
Reference Assemblies/Microsoft/Framework/.NETFramework/v4.X

.Net Framework folders have this UIAutomationClient.dll. i.e. 4.8, 4.7.2 etc..

Am I looking at the wrong place or I need to do something different in .Net Core 3.0 application?

Project Type : .Net Core 3.0 Console Application
Required Namespace : System.Windows.Automation
Required Dll for Reference : UIAutomationClient.dll
Using VS 2019 version 16.3 Preview2
.Net Core SDK version 3.0 Preview8

@leecow
Copy link
Member

leecow commented Sep 5, 2019

@vatsan-madhavan - Any plans to bring automation to Core?

@vatsan-madhavan
Copy link
Member

PS C:\Program Files (x86)\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.0.0-preview8-27908-02\ref\netcoreapp3.0> dir ui*.*                                                                                                                    

    Directory: C:\Program Files
    (x86)\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.0.0-preview8-27908-02\ref\netcoreapp3.0


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          7/6/2019   9:06 PM          35704 UIAutomationClient.dll
-a----         6/14/2019  12:26 PM         184761 UIAutomationClient.xml
-a----          7/6/2019   9:06 PM          15224 UIAutomationClientSideProviders.dll
-a----         6/14/2019  12:25 PM            587 UIAutomationClientSideProviders.xml
-a----          7/6/2019   9:06 PM          21880 UIAutomationProvider.dll
-a----         6/14/2019  12:26 PM          63392 UIAutomationProvider.xml
-a----          7/6/2019   9:06 PM          28024 UIAutomationTypes.dll
-a----         6/14/2019  12:26 PM         105496 UIAutomationTypes.xml

PS C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-preview8-27908-02> dir ui*.*                 

    Directory: C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-preview8-27908-02


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          7/8/2019   2:44 PM         367992 UIAutomationClient.dll
-a----          7/8/2019   2:44 PM         783736 UIAutomationClientSideProviders.dll
-a----          7/8/2019   2:44 PM          46968 UIAutomationProvider.dll
-a----          7/8/2019   2:44 PM         268664 UIAutomationTypes.dll

It's all there.

@vatsan-madhavan
Copy link
Member

@ms0713, Are you using a WindowsDesktop SDK project (Use dotnet new wpf to see an example of one)?

@leecow
Copy link
Member

leecow commented Sep 16, 2019

Closing due to thread going stale. Please reopen if you're still having troubles.

@leecow leecow closed this as completed Sep 16, 2019
@ms0713
Copy link
Author

ms0713 commented Sep 18, 2019

PS C:\Program Files (x86)\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.0.0-preview8-27908-02\ref\netcoreapp3.0> dir ui*.*                                                                                                                    

    Directory: C:\Program Files
    (x86)\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.0.0-preview8-27908-02\ref\netcoreapp3.0


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          7/6/2019   9:06 PM          35704 UIAutomationClient.dll
-a----         6/14/2019  12:26 PM         184761 UIAutomationClient.xml
-a----          7/6/2019   9:06 PM          15224 UIAutomationClientSideProviders.dll
-a----         6/14/2019  12:25 PM            587 UIAutomationClientSideProviders.xml
-a----          7/6/2019   9:06 PM          21880 UIAutomationProvider.dll
-a----         6/14/2019  12:26 PM          63392 UIAutomationProvider.xml
-a----          7/6/2019   9:06 PM          28024 UIAutomationTypes.dll
-a----         6/14/2019  12:26 PM         105496 UIAutomationTypes.xml

PS C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-preview8-27908-02> dir ui*.*                 

    Directory: C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App\3.0.0-preview8-27908-02


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----          7/8/2019   2:44 PM         367992 UIAutomationClient.dll
-a----          7/8/2019   2:44 PM         783736 UIAutomationClientSideProviders.dll
-a----          7/8/2019   2:44 PM          46968 UIAutomationProvider.dll
-a----          7/8/2019   2:44 PM         268664 UIAutomationTypes.dll

It's all there.

You cant refer it in .Net Core Console Application. Thats limitation.

@ms0713
Copy link
Author

ms0713 commented Sep 18, 2019

@ms0713, Are you using a WindowsDesktop SDK project (Use dotnet new wpf to see an example of one)?

This is working. Thanks!

@godrose
Copy link

godrose commented Sep 18, 2019

@vatsan-madhavan
I installed the latest rc1. Have the same issue. Can't manually reference the assembly due to the following error:
Screen Shot 2019-09-18 at 11 33 06 AM

Below is a portion of .csproj file:

<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
 <Configurations>EndToEndWithFake;EndToEndWithReal;IntegrationWithFake;IntegrationWithReal</Configurations>
    <UseWpf>true</UseWpf>
  </PropertyGroup>

@vatsan-madhavan
Copy link
Member

Can't manually reference the assembly

@godrose What do you mean by that, exactly?

Did you use Visual Studio's Reference Manager dialog to browse to the location of UIAutomation.dll reference assembly (for e.g., something like C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\3.0.0-rc2-19460-02\ref\netcoreapp3.0\UIAutomation.dll) and try to add that as a reference in your .NET Core WPF project - like this ?

image

If my guess is correct, then you can't do that.

All WPF assemblies are already implicitly referenced automatically when using Microsoft.NET.Sdk.WindowsDesktop - you don't have to do anything. This includes UIAutomation.dll.

One caveat - there is currently a bug in .NET Core 3.0 that excludes theme assemblies from being referenced automatically - see dotnet/wpf#765. We plan to fix it in .NET Core 3.1.

@godrose
Copy link

godrose commented Sep 19, 2019 via email

@vatsan-madhavan
Copy link
Member

Thanks for the quick response. The only way I could make this work was copying the dll manually. I see this as a regression .

Would you explain your scenario better, possibly with a self-contained minimal repro project attached? I'm not quite following what you are trying to do that requires you to copy UIAutomationClient.dll manually, or browse to it and add a reference to it using the Visual Studio Reference Manager.

Given the fact that UIAutomationClient.dll is implicitly referenced by all Microsoft.NET.Sdk.WindowsDesktop projects when <UseWPF>true</UseWPF> is set in the project, such projects would get a reference to it automatically without needing any additional work. If you are having to do more here, I'd like to understand your scenario better.

@dlwiii
Copy link

dlwiii commented Jan 3, 2020

What if you need to reference UIAutomation in a program which is not a Desktop app and does not use WPF? Is there a reliable way to ref it besides copying over dlls?

@vatsan-madhavan
Copy link
Member

You can use a FrameworkReference to Microsoft.WindowsDesktop.App.Wpf from a console app and get references to WPF assemblies (which includes UIA* assemblies).

@wiz0u
Copy link

wiz0u commented Mar 13, 2021

Hello
After adding a manual reference to C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\5.0.0\ref\net5.0\UIAutomationClient.dll into my .NET 5.0 WinForms project (as suggested by @vatsan-madhavan), it solved my compilation issue for System.Windows.Automation classes (thanks!)

However, I've got this warning below (but the project builds ok). Any idea how to fix that?

1>    There was a conflict between "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" and "WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35".
1>        "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was chosen because it was primary and "WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" was not.
1>        References which depend on "WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0\WindowsBase.dll].
1>            C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0\WindowsBase.dll
1>              Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0\WindowsBase.dll".
1>                C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0\WindowsBase.dll
1>        References which depend on "WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" [].
1>            C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\5.0.0\ref\net5.0\UIAutomationClient.dll
1>              Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\5.0.0\ref\net5.0\UIAutomationClient.dll".
1>                UIAutomationClient
1>            C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\5.0.0\ref\net5.0\UIAutomationProvider.dll
1>              Project file item includes which caused reference "C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\5.0.0\ref\net5.0\UIAutomationProvider.dll".
1>                UIAutomationClient

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants