Upgrading CodedUI tests for VS2017

Our development teams started upgrading to VS2017 a few months back and the vast majority were completely successful.  One team, however, had an issue with their CodedUI tests not running.  In this post I’ll share the steps we went through to troubleshoot and get their CodedUI tests working in VS2017.

QualityTools References

First task was to update their DLL references.  Visual Studio includes a unit/integration testing framework when installed.  These are used within VS to define, run and debug MSTest and CodedUI tests. 

The first compilation error I received from this project on a fresh Windows 10 install with VS2017 only was the following:

Could not resolve this reference. Could not locate the assembly “Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL”. Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

This means it doesn’t have the older 14.0 version of CodedUI.  Obviously, this is because I only have VS2017 installed.

I mucked around with the references and then got (not sure why):

Severity    Code    Description    Project    File    Line    Suppression State
Error    CS0433    a, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ and ‘Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’   

Ultimately, for our integration test project using CodedUI we required the following in VS2017:

image

Specifically, version 15.0 for CodedUITestFramework/Common and 10.0 for UnitTestFramework.  I don’t think the UnitTestFramework assembly has been updated since version 10.0 and is used by all versions of VS after 2010.

image

You can reference these from the Reference Manager dialog (right click on References and choose Add Reference).  They are listed under Assemblies and Extensions.

image

Assembly Redirect

Visual Studio is smart enough to recognized that you are referencing older versions of some of these DLLs and does offer to add assembly bindings to the config file.  This does work but I always prefer to simply update all the references explicitly.

Here is an example of the assembly redirects:

<runtime>
     <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″>
             <dependentAssembly>
                 <assemblyIdentity name=”Microsoft.VisualStudio.TestTools.UITest.Common” publicKeyToken=”B03F5F7F11D50A3A” culture=”neutral”/>
                 <bindingRedirect oldVersion=”0.0.0.0-15.0.0.0″ newVersion=”15.0.0.0″/>
             </dependentAssembly>
             <dependentAssembly>
                 <assemblyIdentity name=”Microsoft.VisualStudio.TestTools.UITest.Framework” publicKeyToken=”B03F5F7F11D50A3A” culture=”neutral”/>
                 <bindingRedirect oldVersion=”0.0.0.0-15.0.0.0″ newVersion=”15.0.0.0″/>
             </dependentAssembly>

And that is it, not too hard right?   Hopefully this helps others get their tests running on the latest version of Visual Studio.  Did this work for you or did you have further problems?  If so, share your experience below in the comments.

Happy Testing!

2 thoughts on “Upgrading CodedUI tests for VS2017”

  1. Nicolas Parisse

    Hi,

    I am upgrading test solution from VS 2010 to VS2017 framework 4.7.2.
    I am experiencing the same kind of issue for following references:
    – Microsoft.VisualStudio.TestTools.UITest.Common
    – Microsoft.VisualStudio.TestTools.UITesting
    – Microsoft.VisualStudio.QualityTools.CodedUITestFramework
    – Microsoft.VisualStudio.QualityTools.UnitTestFramework

    Those references doesn’t appear in the Assemblies > extensions panel.

    I also do not find them from the NuGet package.

    Adding manually those reference by copy/pasting them from my old project give me the same issue you encountered.

    If I found the solution of my issue, I’ll poost it here.

Leave a Reply