10
votes

I configured now a new computer. Installed VS 2010 and all necessary component, got my running project on that new computer..

Compiling the project shows me that VS 2010 cannot find the reference "Microsoft.VisualStudio.QualityTools.UnitTestFramework".

This assembly is located in Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies

But VS is not able to find it.

The used project is OK. It can be compiled on my old machine!

Edit: The error while compiling: error CS0234: The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.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.

12
I am trying to solve this issue by uninstalling VS again.Ferhat
Solved it: - Uninstalled VS 2008 and VS2010 including all updates - Installed VS2008 full, VS2010 full Now it works...damn! The cause is still unknown!Ferhat

12 Answers

4
votes

Upgrade of some 2003 code for us was resolved through the following:

  1. Removing the existing broken reference
  2. Updating the project from .Net 3.5 to .Net 4 (not the client version)
  3. Adding the new one from VS2010 OR VS2012

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

The existing "USING" statement worked without change. "using Microsoft.VisualStudio.TestTools.UnitTesting;"

4
votes

I had the same problem.

Old machine:
    Windows XP, 32 bit
    VS 2010 (32 bit)

New machine:
    Windows 7, 64 bit
    VS 2010 (32 bit)

I solved it by simply deleting the reference to Microsoft...UnitTestFramework, and adding the new one, which was here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

I did not need to change the target .NET framework version.

2
votes

Check that your project is not marked for X64 platform in a mixed solution configuration (right click the solution -> Configuration Manager option). After changing the platform for the test project from X64 to Any CPU the assemblies were recognized and it worked.

2
votes

Forget to mark this as solved: What I did:

Uninstalled VS 2008 and VS2010 including all updates - Installed VS2008 full, VS2010 full Now it works! The cause is still unknown!

2
votes

Staggering: 7 years on, still an issue

The solution that worked for me (Visual Studio 2017, Pro) was to delete the reference from the list (see image below) and then re-add it. enter image description here

1
votes

No Solution, just some hints:

// using Microsoft.VisualStudio.QualityTools.UnitTestFramework
// Path: %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

You also need to check the versions. There are two out by now (10.1.0.0 and 10.0.0.0) A wrong will result in such an error.#

All versions of the unity-framework can be found at Codeplex. unity.codeplaex.com

1
votes

Compile against the .DotNet4 Framework 4 instead of the .DotNet4 Framework 4 Client Profile might also solve the problem.

1
votes

I was getting the same problem, but found that in the references it was set as GAC, so I removed this and put it in the BIN folder. When it was on one server it was fine but that was because it was registered on that machine and not the other

1
votes

I believe your problem is that you have a project that was created on a machine with VS2010 SP1 installed and you are running on a machine with VS2010 (no SP). I recently had to change machines and my IS department installed an image on the new machine with VS2010, just like I asked.

When I pulled my code down out of source control, all of a sudden I couldn't run the unit tests because "Could not locate the assembly "Microsoft.VisualStudio.QualityTools.UnitTestFramework"

Then I remembered that I had installed SP1 on my old machine. So I installed VS2010 SP1 on the new machine and magically the problem went away.

So try downloading and installing SP1

1
votes

I had the same problem, too. It was caused by an config file automatically generated for the unit test dll, I didn't notice. The app.cfg - file content was:

<?xml version="1.0"?>
    <configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity      name="Microsoft.VisualStudio.QualityTools.UnitTestFramework" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/>
            <bindingRedirect oldVersion="0.0.0.0-10.1.0.0" newVersion="10.1.0.0"/>
        </dependentAssembly>
    </assemblyBinding>
</runtime>
 <startup>
     <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
 </startup>

I have just removed that app.cfg file and everything worked fine without any other changes again.

0
votes

I had same problem. You need to change target framework of your project from ".Net Framework 4 Client Profile" to ".Net Framework 4"

It worked for me.

0
votes

I had the same problem in an old project targeting DotNet Framework 2; updating it to DotNet Framework 3.5 solved it for me.