How to fix the error: "CS0012 The type 'Task' is defined in an assembly that is not referenced. "
<p>It's very strange that the projects are built successfully, but got this error in Visual Studio 2015:</p>

<blockquote>
  <p>Error CS0012  The type 'Task' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.</p>
</blockquote>

<p>Here are what I do:</p>

<ol>
<li><p>I create a Class Library Project (.Net Core) in VS2015 Update3, named <code>Library</code>, and change the <code>project.json</code> as follows:</p>

<pre><code>{
  "version": "1.0.0-*",
  "frameworks": {
    "net35": {
      "dependencies": {
        "TaskParallelLibrary": "1.0.2856",
        "AsyncBridge.Net35": "0.2.0"
      }
    },
    "net40": {
      "dependencies": {
        "Microsoft.Bcl.Async": "1.0.168"
      }
    }
  }
}
</code></pre>

<p><code>Library</code> is multi-targeting net35 and net40, and depends on a few packages so that we can use <code>async</code> and <code>await</code> in net35 and net40.</p></li>
<li><p>Add class <code>Foo</code>:</p>

<pre><code>using System;
using System.Threading;
using System.Threading.Tasks;
namespace Library {
    public class Foo {
        public async Task Bar() {
            await Task.Factory.StartNew(() =&gt; {
                Console.WriteLine("bar");
            }, new CancellationTokenSource().Token);
        }
    }
}
</code></pre></li>
<li><p>Create another Class Library Project (.Net Core), named <code>SomeApp</code>, with the <code>project.json</code>:</p>

<pre><code>{
  "version": "1.0.0-*",
  "dependencies": { "Library": "1.0.0" },
  "frameworks": {
    "net35": {
      "dependencies": {
        "TaskParallelLibrary": "1.0.2856",
        "AsyncBridge.Net35": "0.2.0"
      }
    },
    "net40": {
      "dependencies": {
        "Microsoft.Bcl.Async": "1.0.168"
      }
    }
  }
}
</code></pre>

<p><code>SomeApp</code> is referencing <code>Library</code>.</p></li>
<li><p>Add class <code>App</code> in <code>SomeApp</code> project:</p>

<pre><code>using Library;
using System.Threading.Tasks;
namespace SomeApp {
    public class App {
        public async Task DoWork() {
            var foo = new Foo();
            await foo.Bar();
        }
    }
}
</code></pre>

<p><code>App</code> is calling <code>Foo.bar()</code>.</p></li>
</ol>

<p><strong>It's able to built both projects, and there are nothing wrong during the compilations</strong>, but if you click the <code>App.cs</code> in <code>SomeApp</code> project in Solution Explorer in VS2015, the error appears in the Error List:</p>

<p><a href="https://i.stack.imgur.com/HHkP4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HHkP4.png" alt="enter image description here"></a> </p>

<p>So how do i fix the error? And is this a bug of Visual Studio?</p>