ASP.NET Core RC2 Project Reference "The Dependency X could not be resolved" : <h2>Overview</h2>

<p>I've got an ASP.NET Core RC2 .NET framework web project, and I'd like to add a project reference to my regular C# class library contained within the same solution.</p>

<h2>Steps to repro:</h2>

<p>Using Visual Studio 2015 Update 2</p>

<p>File -> New Project -> <code>ASP.NET Core Web Application (.NET Framework)</code></p>

<p>Right click solution -> New Project -> <code>Class Library</code></p>

<p>I'm not making any of these:</p>

<ul>
<li><code>Class Library (.NET Core)</code></li>
<li><code>Class Library (Portable for iOS, Android, and Windows)</code></li>
<li><code>Class Library (Portable)</code></li>
</ul>

<p>Add the following to <code>dependencies</code> in project.json:</p>

<pre><code>"ClassLibrary1": {
  "version": "*",
  "target": "project"
}
</code></pre>

<h2>Issue</h2>

<p>Why can I not add <code>"target":"project"</code> to my dependencies when specifying a project dependency?</p>

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

<h2>Expectation</h2>

<p>I expect this ASP.NET Core RC2 web application (.NET Framework) to be able to reference a regular class library as a project reference.</p>

<p><strong>This works</strong></p>

<pre><code>"ClassLibrary1": "*"
</code></pre>

<p><strong>This does not work</strong></p>

<pre><code>"ClassLibrary1": {
  "version": "*",
  "target": "project"
}
</code></pre>

<h2>My Question</h2>

<p><strong>How do I add a project reference to my regular class library from an ASP.NET Core RC2 web project?</strong></p>

<h2>Additional Information</h2>

<p>If I run <code>dotnet restore</code> I get a better error message on why this can not be resolved.</p>

<pre><code>dotnet : 
At line:1 char:1
+ dotnet restore
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Errors in C:\users\joshs\documents\visual studio 2015\Projects\WebApplication4\src\WebApplication4\project.json

    Unable to resolve 'ClassLibrary1' for '.NETFramework,Version=v4.6.1'.
</code></pre>

<p>I doubled checked the class library targets .NET Framework 4.6.1</p>

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

<p>I've already taken a look at <a href="https://stackoverflow.com/questions/37309368/cannot-add-reference-to-net-core-class-library-asp-net-core-rc2">cannot add reference to .net core Class library asp.net core rc2</a>, but that's for a .NET Core class library.</p>

<p>I also looked at <a href="https://stackoverflow.com/questions/37398128/reference-a-full-framework-library-project-from-asp-net-core-mvc-web-application">Reference a Full Framework Library Project from ASP.NET Core MVC Web Application (RC2)?</a>, but that's because the user was trying to create a web project not targeting .NET Framework.  My project.json contains:</p>

<pre><code>  "frameworks": {
    "net461": { }
  },
</code></pre>

<p>If I right click my web project and 'Add reference' and then proceed to pick my class library, it puts the project dependency in a different part of the project.json, but it still gives me the same error message.</p>

<pre><code>"frameworks": {
  "net461": {
    "dependencies": {
      "ClassLibrary1": {
        "target": "project"
      }
    }
  }
},
</code></pre>
