Compartilhar via


Public Service Announcement: How to fix new Test Projects on July CTP

So, you’ve gotten the new July CTP, and you’ve opened your old Test Projects and everything’s OK. Now it’s time to create some new ones (Or maybe you’re just checking out the Test Tools for the first time). You start Visual Studio, Select File|New|Project|Visual C#|Test|Test Project, and click OK. The gears grind & whirr for a few moments until you are presented with a dialog like the one below:

Well, it seems that a small issue slipped through the cracks on the last build that ended up being released as this CTP. Luckily it’s a very simple issue which you can fix by either editing a series of files or downloading a file. There is also a workaround those that don’t want to create Unit Tests.

Workaround
1. Start Visual Studio
2. Go to Tools | Options | Test Tools | Test Project
3. For each of the Language types uncheck “Unit Test”
4. Click OK

You should now be able to create test projects. If you really want a unit test, you can either add it by hand (e.g. write the code & using statements), or you can use Code Generation.

The Fix
If you want to download the file, just download this.

1: Open it in explorer, and drag the contents into %VSINSTALLDIR%\Common7\IDE\ItemTemplates. E.g.:
C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ItemTemplates
2: Then, Start|Run|devenv /setup
3: Wait ~5minutes (If you want to watch, look at Task Manager, and see the devenv.exe process on the processes tab).

You’re good to go.

If you don’t want to download the file, you can do it the hard way.

1. Open up %VSINSTALLDIR%\Common7\IDE\ItemTemplates in Explorer
2. Intern, go into:
CSharp\1033\
VisualBasic\1033\
VisualC\1033\

3. In each of these directories, copy out SimpleUnitTest.zip to its own directory i.e. Create the following on your desktop
• CSharp
• VisualBasic
• VisualC

4. Within each of these directories, Copy the files out of the zip files. This should be SimpleUnitTest.vstemplate and SimpleUnitTest.<language file extension> (E.g. .cs, .vb, .cpp)
5. For each of SimpleUnitTest.vstemplate files:

a. Open in notepad
b. In the <References/> section add:
<Reference>
<Assembly>Microsoft.VisualStudio.QualityTools.UnitTestFramework</Assembly>
</Reference>
c. And remove the <WizardExtension/> section. Save the file.

6. Re-zip the two files back again, giving the zip the name “SimpleUnitTest.zip”
7. Copy the zip files back to their respective <language>\1033 directories.
8. Start|Run|devenv /setup
9. Wait ~5minutes (If you want to watch, look at Task Manager, and see the devenv.exe process on the processes tab).

There, you’re done!

We have fixed this in our current builds, and won’t be seeing this again :)

Comments