VSTS: Getting coded web tests to run

The coded web tests supported by the VSTS test tools really excite me. There are so many web test scenarios that I can now create very easily with a combination of recording and scripting. This will nicely complement the ASP.Net testing capabilities I already have thanks to NUnitAsp.

However when I recorded a web test, generated the code from the test, and then tried to use that test the test runner wasn't able to load my assembly. It gave me an error similar to this:

WebTestCoded Coded Web Test Error Could not run web test 'WebTestCoded' on agent 'MyComputer': Could not create instance of class 'WebTestCoded' :File or assembly name 'WebTestProject1, Version=, Culture=neutral, PublicKeyToken=null', or one of its dependencies, was not found.  

So I jumped on the Microsoft newsgroups and just got a reply to my query: You have to copy the assembly to VSDIR\Common7\IDE\PrivateAssemblies.

To help with this process, add a post build event similar to the one below to all projects with coded web tests: copy WebTestProject1.dll "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies"

Thanks to Eric Adams (PM - VSTS Test) for this solution!