Converting a Class Library to an MS Test Library

by timvasil 6/10/2008 5:15:00 PM

If you add the [TestMethod] attribute to methods in a regular class library, they won't show up in the test view or test editor.  You may see a message "no tests are loaded."  This happens because Visual Studio doesn't look for the attribute in projects that don't have special "I am a test" markings.  If you create a test project from scratch and add the code the problem will go away, but if you've spent time customizing a project, its references, etc., fear not; you don't need to start over.  Edit the .csproj (or .vbproj) file manually and add the following XML as a child of the first <PropertyGroup> element that appears:

<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Visual Studio | MSTest

Related posts

Comments are closed

 

About the author

Tim Vasil Tim Vasil
I'm a software engineer living in Cambridge, MA.

E-mail me Send mail

Search

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments