500 Error Running Visual Studio ASP.NET Unit Test

I’ve had this problem before and at that point gave up after reading all I could google about it (including this thread).

The solution turned out to be simple in my case. All I had to do was not use ASP.NET test attributes and simply test the MVC project as a DLL.

Step 1

Remove the extra attributes from the test.

[TestMethod]
public void TestMethod1()
{
    Page page = TestContext.RequestedPage;
    Assert.IsTrue(false, "Test ran, at least.");
}

Step 2

In Code Coverage, uncheck the MVC Project and add the MVC Project’s DLL manually.

alt text

Voila, it get instrumented as a normal assembly, no errors, doesn’t spin up the Development Server, also doesn’t fail the Team Build.

Leave a Comment