How to build a interop dll from the UIAutomationCl

2019-08-09 08:51发布

问题:

I want to create / build a interop dll from the existing UIAutomationClient.dll Version 4.0.. I tried to use the TlbImp.exe with the following command:

TlbImp.exe path\UIAutomationClient.dll out:Interop.UIAutomationClient.dll

But i'm getting the following error message:

Microsoft (R) .NET Framework Type Library to Assembly Converter 4.0.4013 Copyright (C) Microsoft Corporation. All rights reserved.

TlbImp : error TI0000 : The input file 'C:\Users\patrick\Desktop\UIAutomationCli ent.dll' is not a valid type library.

Is there another way to create the interop dll or a solution to this error ?

回答1:

It is present on your machine in the Common7\IDE\PublicAssemblies subdirectory of your VS install directory. It carries a Microsoft copyright and is not part of the redistributable files so just making a copy is a bit iffy, even though it doesn't contain any code.

You can create your own by running Tlbimp.exe on c:\windows\syswow64\uiautomationcore.dll. Use system32 on a 32-bit operating system.

You ought to wonder a bit about the reason you have a dependency on it.