locked
Reason Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.. RRS feed

  • Question

  • Hi, All

    I am having trouble Running some UI tests on the test server.

    The reason seems to be the that the CodedUITestFramework cannot be found in the correct version.

    We develop the Tests in Microsoft Visual studio 2017 and the Test Server has  Microsoft Team Foundation Server 14.0 for building the Project.

    I tried various things to fix that, before my changes I was getting a different error for the version of TFS foundation server

    Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 
    or one of its dependencies. The system cannot find the file specified..

    So I tried to change my .csproj file in order to make IsCodeUITest as false because if it is true it changes this file automatically on build and copied the desired Dlls from Microsoft folder to the project library folder and commit those files as for the TFS Build agent to use those. I also added an app.config file to set the dependency assembly but that still don't change the fact that the Builder does not use the desired Dlls.

    I see that this is in general a common problem but I cannot solve it.

    Am I missing something? Heads up I am relatively new to C# so any help would be helpful.

    .csproj file 

      

    <IsCodedUITest>False</IsCodedUITest>

    <ItemGroup>
        <Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework">
          <HintPath>..\Libraries\Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll</HintPath>
          <Private>False</Private>
        </Reference>
        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common">
          <HintPath>..\Libraries\Microsoft.VisualStudio.TestTools.UITest.Common.dll</HintPath>
          <Private>False</Private>
        </Reference>
        <Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension">
          <HintPath>..\Libraries\Microsoft.VisualStudio.TestTools.UITest.Extension.dll</HintPath>
          <Private>False</Private>
        </Reference>
        <Reference Include="Microsoft.VisualStudio.TestTools.UITesting">
          <HintPath>..\Libraries\Microsoft.VisualStudio.TestTools.UITesting.dll</HintPath>
          <Private>False</Private>
        </Reference>
      </ItemGroup>

    App.config file

          <dependentAssembly>
            <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.CodedUITestFramework" 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.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.Extension" 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.UITesting" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
          </dependentAssembly>    


    Sunday, April 12, 2020 12:46 PM

All replies

  • Hi Manolis Theodoroudis,

    Welcome to MSDN forum.

    Could the test run successfully on local environment? Please have a try following points:

    • remove CodeUITestFramework and re-reference it
    • check if UnitTestFramework has been added into your project and change IsCodedUITest to true 
    • create a new project if it could build succesfully

    If it can build on local environment, we suggest you can install visual studio 2017 on agent server , which is general method. And you can also redirect to developer community with tfs tag or stack overflow with tfs and code-ui-test tag to get better support.

    Any feedback will be expected.

    Best Regards,

    Dylan

     


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, April 13, 2020 3:54 AM
  • Hi Dylan

    Thank you for your prompt response.

    I tried re-referencing CodeUITestFramework 

    The UnitTestFramework has been added by the following Nuget file

        <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework">
          <HintPath>..\packages\VS.QualityTools.UnitTestFramework.15.0.27323.2\lib\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
        </Reference>


    Locally it is build successfully and the test cases run without any issues.

    The thing is that in the server I get the following message

    C:\Program Files (x86)\MSBuild\14.0\bin\amd64\Microsoft.Common.CurrentVersion.targets (1820): Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed.

    And the test runner has the following error 

    Run VS Test Runner
    MSTestAdapter failed to discover tests in class 'WebdriverAutomationTesting.Tests.BaseTest' of assembly 'C:\Builds\6\Webdriver Automation Testing\DefaultDevelopmentBuild\bin\WebdriverAutomationTesting.dll'. Reason Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..


    If I make the IsCodedUITest as TRUE my References look like duplicates and I have to remove them. 

    Locally it still works but in the server I have a different error.

    Unit Test Adapter threw exception: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..

    The test runner has this error log

    Run VS Test Runner
    No test found. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.

    So when I try to run my test cases by the test agent it fails due to this

    Unit Test Adapter threw exception: Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..


    Best Regards

    Manolis

    Monday, April 13, 2020 10:15 PM
  • Hi Manolis,

    Thank you for reply.

    Do you have a try to install visual studio 2017 on test server?

    In addition, please confirm all your nuget packages has been restored using task in test server, and the relative path of nuget package location is the same as the local environment.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, April 14, 2020 6:52 AM
  • Hi Dylan 

    After a number of different tries the only thing that did the trick was to update the agents to 2017.
    Thank you very much for your support

    Best Regards

    Manolsi

    Thursday, May 7, 2020 8:23 AM
  • Hi Manolis,

    Thank you for sharing. If you have other issues about test tool in the future. Please feel free to contact us.

    Have a nice day.

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, May 7, 2020 8:27 AM