Visual Studio persists on using UnitTestFramework 10.0.0.0
Asked Answered
A

2

12

I've got a solution with several projects in it. One of the projects includes additional Assert methods for unit testing. It references Microsoft.VisualStudio.QualityTools.UnitTestFramework 10.1.0.0. It also includes other test projects, which reference both Microsoft's UnitTestFramework and my project with additional assert methods.

Whenever I restart visual studio and compile, I get the following warning:

Found conflicts between different versions of the same dependent assembly.

I have tried changing all the references to the UnitTestFramework to 10.1.0.0, but upon restarting Visual Studio seems to set them to 10.0.0.0 again. I have even tried changing the project file outside of Visual Studio, but upon opening the project in Visual Studio the references show the old version in the solution explorer again. When closing Visual Studio without doing any file modifications, it asks whether or not to save changes to the project files.

How do I prevent Visual Studio from changing the version of my referenced UnitTestFramework in my projects?

Autonomous answered 24/3, 2012 at 17:18 Comment(2)
@KMoraz I now have a new laptop, with a clean installation. I downloaded the project again and these problems persist. I believe either something is wrong with the project files, or it is a bug of Visual Studio.Autonomous
This problem is still occurring in Visual Studio 2013, Update 4.Autonomous
F
4

Had same problem. One of our developers was reorganizing assemblies and his VS for some unknown reason changed this:

<Choose>
  <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
    <ItemGroup>
      <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
    </ItemGroup>
  </When>
  <Otherwise>
    <ItemGroup>
      <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
    </ItemGroup>
  </Otherwise>
</Choose>

into this:

<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Choose>
  <When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
    <ItemGroup>
      <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
    </ItemGroup>
  </When>
  <Otherwise />
</Choose>

The first line of which kept getting changed on everyone else's system (same symptoms as you).

Since we have no plans to support 3.5 anyway, I fixed it by removing the "Choose" section and simplifying into:

<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />

(removing the specific version altogether from the reference)

Fergus answered 22/4, 2013 at 20:5 Comment(2)
For some reason, this seems to work. However, it is worthwhile noting that this seemingly results in 10.0 being loaded. When all references are set to 10.0, and thus no 10.1 is loaded, it also works. Not specifying the version can thus simply be one way of ensuring 10.1 is not loaded, which is a more general way of avoiding this (bug?).Autonomous
In addition, (although this might be totally coincidental) it seems like it takes much longer (> 1 minute) to close down Visual Studio when following this approach? :/Autonomous
G
0

In my case, in VS2017+Resharper, I deleted the reference to v 10.0.0.0 and re-added the reference to 10.1.0.0. Simply re-assigning the reference in the References browser did not do the trick, nor, weirdly, did reverting the changes to my Tests.csproj file in version control.

Grappling answered 5/9, 2019 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.