简体   繁体   中英

The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

Getting the error

The type or namespace name 'VisualStudio' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

on a project using MS Test 2 Framework. I read the link here but it didn't help.

I believe I have the required references and object browser seems to find them: References参考 Object Browser: 对象浏览器

Nevertheless I'm getting tons of errors in my unit test project, starting with the one above.

How can I resolve this so the build can find the references it needs?

In my case (vs2017 + TFS Builds), I ended up removing the MSTest v2 packages and installed the MSTest v1 package because our build servers don't support v2 yet. My solution would build locally but fail on our build server.

  • Went into Manage NuGet Packages
  • Uninstalled MSTest.TestAdapter & MSTest.TestFramework
  • Installed VS.QualityTools.UnitTestFramework

Rebuild & Run tests to make sure and then check-in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM