简体   繁体   English

无法在VS2013中创建测试,没有Microsoft.VisualStudio.TestTools.UnitTesting命名空间

[英]Can't create test in VS2013, no Microsoft.VisualStudio.TestTools.UnitTesting namespace

I'm new to C#, .NET and VS; 我是C#,.NET和VS的新手; using VS 2013 Ultimate. 使用VS 2013 Ultimate。 I'm trying to create a unit test using what seems to be the "VS way" but can't figure it out. 我正在尝试使用似乎是“VS方式”的东西来创建一个单元测试,但无法弄明白。

It looks like the culprit is that I don't have access to the Microsoft.VisualStudio.TestTools.UnitTesting.Assert method or enclosing namespace... I've looked all around and can't find any references to this namespace. 看起来罪魁祸首是我无法访问Microsoft.VisualStudio.TestTools.UnitTesting.Assert方法或封闭命名空间......我已经四处寻找并找不到对此命名空间的任何引用。 Is this something extra I need to install? 这是我需要安装的额外内容吗? At this point I have no idea what to look for. 在这一点上,我不知道该寻找什么。

I'm working around it with additional Main methods, which is a huge PITA... 我正在使用其他主要方法,这是一个庞大的PITA ......

welcome to .NET development! 欢迎来到.NET开发!

By default, Visual Studio will add references to the most common namespaces/classes to your project when the project is created. 默认情况下,Visual Studio将在创建项目时向项目添加对最常见名称空间/类的引用。 TestTools.UnitTesting is not one of those namespaces, so you'll have to add a reference to the file where it lives, which is in Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll . TestTools.UnitTesting不是其中一个名称空间,因此您必须添加对其所在文件的引用,该引用位于Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

Check out this thread for how to add references (I think your question duplicates it): 查看此主题以了解如何添加引用(我认为您的问题重复了它):

You need a reference to Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll in your project. 您需要在项目中引用Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll。 It's installed with VS so you should have it listed in the Add Reference dialog. 它随VS一起安装,因此您应该在“添加引用”对话框中列出它。 But the correct way would be to create project from "Unit Test" template that will add the reference in advance. 但正确的方法是从“单元测试”模板创建项目,该模板将提前添加引用。

For VS2013, add reference to 对于VS2013,添加引用

Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll

from

C:\Program Files\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 与Microsoft.VisualStudio.TestTools.UnitTesting命名空间相关的错误 - Error related to Microsoft.VisualStudio.TestTools.UnitTesting namespace 测试订单Microsoft.VisualStudio.TestTools.UnitTesting问题? - Test order Microsoft.VisualStudio.TestTools.UnitTesting issue? Microsoft.VisualStudio.TestTools.UnitTesting 测试资源管理器蓝色感叹号 - Microsoft.VisualStudio.TestTools.UnitTesting test explorer blue exclamation Microsoft.VisualStudio.TestTools.UnitTesting提供错误 - Microsoft.VisualStudio.TestTools.UnitTesting Giving Error Microsoft.VisualStudio.TestTools.UnitTesting中的QueueBackgroundWorkItem - QueueBackgroundWorkItem from Microsoft.VisualStudio.TestTools.UnitTesting 为什么Microsoft.VisualStudio.TestTools.UnitTesting无法获得DbSet <T> 从数据库返回 - Why can't Microsoft.VisualStudio.TestTools.UnitTesting get the DbSet<T> returned from database 在NUnit.Framework和Microsoft.VisualStudio.TestTools.UnitTesting命名空间中也发现了NUnit断言方法错误 - NUnit Assert method error as it is found in NUnit.Framework and Microsoft.VisualStudio.TestTools.UnitTesting namespace as well 如何在不借助Visual Studio的情况下使用Microsoft.VisualStudio.TestTools.UnitTesting为程序添加单元测试? - How can I add a unit test for a program using Microsoft.VisualStudio.TestTools.UnitTesting, but without the aid of Visual Studio? 使用Microsoft.VisualStudio.TestTools.UnitTesting编译错误 - using Microsoft.VisualStudio.TestTools.UnitTesting compile error 哪里可以找到“Microsoft.VisualStudio.TestTools.UnitTesting”丢失的dll? - Where to find “Microsoft.VisualStudio.TestTools.UnitTesting” missing dll?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM