title: Asynchronous unit tests with .NET 4.0
body: <p>I have a fairly standard set of unit tests.</p>
  
  <pre><code>[TestClass]
  public class MyTestClass
  {
      [TestMethod]
      public async Task MyClass_DoesStuff()
      {
          //...
          await foo;
      }
  }
  </code></pre>
  
  <p>This was all working fine, but then I needed to downgrade to .NET 4.0. I made the necessary package installations and got everything building. However, now my unit tests no-longer work. Instead, I get these errors:</p>
  
  <blockquote>
    <p>UTA007: Method MyClass_DoesStuff defined in class MyTestClass does not have correct signature. Test method marked with the [TestMethod] attribute must be non-static, public, return-type as void  and should not take any parameter. Example: public void Test.Class1.Test(). Additionally, return-type must be Task if you are running async unit tests. Example: public async Task Test.Class1.Test2()</p>
  </blockquote>
  
  <p>Perhaps the test runner does not recognize <code>System.Threading.Tasks.Task</code> for .NET 4.0? I installed <code>Microsoft Async</code>, <code>Microsoft BCL Build Components</code>, and <code>Microsoft BCL Portability Pack</code> from NuGet.</p>
  
  <p>Is there a way for me to get asynchronous unit testing working for .NET 4.0?</p>
  
  <p><strong>Edit</strong>:</p>
  
  <p>The "duplicate" this was flagged as (<a href="https://stackoverflow.com/questions/22458371/testmethod-async-task-teststh-does-not-work-with-net-4-0">TestMethod: async Task TestSth() does not work with .NET 4.0</a>) was for the test not showing up in test explorer, whereas in my case I got the error as I posted. Not a duplicate. </p>