Raphael Raphael - 1 year ago 137
C# Question

CodedUiTest Reference Conflict between UiaComWrapper and UIAutomation

I have a CodedUitest Project which tests a komplex WPF Project using .net Framework 4.0. In the Testproject i use AutomationElement.TryGetClickablePoint. You need to know too, that i try to get it to run on a TestBuild on TFS. Both are VS2013 Update 3

And here it is where the Issue starts. I have a Conflict between UiaComWrapper and UIAutomationClient and also UIAutomationTypes. In the UiaComWrapper it seems AutomationElement.TryGetClickablePoint want a System.Drawing.Point as Parameter and in UIAutomation… it want a System.Windows.Point as Parameter.

I tried some solutions i found in the Internet also from here and some own ideas too but in the one way it runs local but not on the TFS because it says AutomationElement would exists in both (ComWrapper and UIAutomation) or without references to UIAutomation it can’t find types like „AutomationElement“ on the Server.

On the other Hand if i add UiAutomation it runs not local

I also tried the Idea to Change the Alias but it also does not helping out, cause then it says again that the types like "AutomationElement" are not known.

Is there any way to get it to work in both ways? Or at least a way to remove this UiaComwrapper full from the Solution, cause then I could change the Parameter to System.Windows.Point and so get rid of the Issue?

Answer Source

I solved it on my own. Here are what it is all about. The conflict between the headers of AutomationElement.TryGetClickablePoint is because AutomationElement is defined in both Assemblies.

If you get conflicts between UiaComWrapper and UiAutomationClient and or UiaAutomationTypes for the AutmationElement class for example, which is often used by CodedUITests, you need only to Reference the UiaComWrapper in you References and if you get this error on your build server you need to check your .csproj file if there is an entry of this reference or not. If this entry is missing, remove it from your references and add it again or use this line if needed.

<Reference Include="UIAComWrapper, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />

You should add it into an itemGroup where other references are in the File.

After that fix retry your Build or Builddefinition and it should be fixed. That was the way I got it fixed.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download