core icon indicating copy to clipboard operation
core copied to clipboard

UIAutomationClient.dll not found

Open ms0713 opened this issue 7 years ago • 13 comments

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

ms0713 avatar Aug 30 '19 11:08 ms0713

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

leecow avatar Sep 05 '19 00:09 leecow

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 avatar Sep 05 '19 00:09 vatsan-madhavan

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

vatsan-madhavan avatar Sep 05 '19 01:09 vatsan-madhavan

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

leecow avatar Sep 16 '19 20:09 leecow

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 avatar Sep 18 '19 08:09 ms0713

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

This is working. Thanks!

ms0713 avatar Sep 18 '19 08:09 ms0713

@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>

godrose avatar Sep 18 '19 08:09 godrose

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 https://github.com/dotnet/wpf/issues/765. We plan to fix it in .NET Core 3.1.

vatsan-madhavan avatar Sep 18 '19 20:09 vatsan-madhavan

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

On Wed, 18 Sep 2019 at 23:42 Vatsan Madhavan [email protected] wrote:

Can't manually reference the assembly

@godrose https://github.com/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: image] https://user-images.githubusercontent.com/20246435/65184214-e7d45280-da19-11e9-90f4-56c0d84f8a1a.png

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 https://github.com/dotnet/wpf/issues/765. We plan to fix it in .NET Core 3.1.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dotnet/core/issues/3283?email_source=notifications&email_token=AB3OIIYBZJ2NWXSYOHCIIADQKKHETA5CNFSM4ISMIKOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7BME6I#issuecomment-532857465, or mute the thread https://github.com/notifications/unsubscribe-auth/AB3OII34KASFH4JJMTWXI6DQKKHETANCNFSM4ISMIKOA .

-- Best Regards, Gena

godrose avatar Sep 19 '19 10:09 godrose

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.

vatsan-madhavan avatar Sep 19 '19 17:09 vatsan-madhavan

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?

dlwiii avatar Jan 03 '20 05:01 dlwiii

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

vatsan-madhavan avatar Jan 03 '20 07:01 vatsan-madhavan

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

wiz0u avatar Mar 13 '21 19:03 wiz0u