Thursday, June 12, 2008

Converting a Class Library Project to a Test Project

Here's a VisualStudio 2008 tip. Have you ever created a C# project of type "Class Library", and then later you want to change it to a Test Project? Here's how:

1. Edit the .csproj file in Notepad and insert the following line:

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


Just before the first tag in the file

2. Right-click the solution in Solution Explorer and Add New Item... Choose new Test Run Configuration.

3. If your test cases need some data files (such as xml files) you can either edit the Test Run Configuration and add them to Deployment, or add the attribute

[DeploymentItem("MyXMLFile.xml")]

No comments: