在Visual Studio 2010 Pro中,如何轻松将经典程序集转换为ms单元测试程序集?
In Visual Studio 2010 Pro, how can I easily convert a classic assembly to a ms unit test assembly ?
.csproj文件中是否有要激活的标志?
It there a flag to activate in the .csproj file ?
推荐答案问题是测试项目在项目文件上被标记"了-您可以按照以下四个简单步骤将类库转换为Test项目:
The problem is that test projects are "marked" on the project file - you can convert a class library to Test project follow these four simple steps:
将以下行添加到项目中C#:
add the following line to the project C#: <Project> <PropertyGroup> <AssemblyName>....</AssemblyName> <!-- add this line below --> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> </PropertyGroup> </Project>
VB-< ProjectTypeGuids> {3AC096D0-A1C2-E12C-1390-A8335801FDAB}; {F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
请注意,您将需要手动添加对Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll的引用,以便能够使用与测试相关的属性
更新:在即将推出的MSTest V2中,这将不再是必需的,因为MSTest成为一个NuGet程序包,其工作方式与NUnit/XUnit一样
Update: In the upcoming MSTest V2 this will not be nesessery as MSTest becomes a NuGet package which works just like NUnit/XUnit
更多推荐
如何将现有程序集转换为ms单元测试程序集?
发布评论