title: How to solve the error "Must use PackageReference"?
body: <p>After adding <code>WindowsRuntime</code> to a WinForms-project, building the project fails with Error &quot;Must use PackageReference&quot;. The build log is more precise:</p>
  <blockquote>
  <p>C:[...]\Visual Studio 2017\Projects\Projectname\packages\Microsoft.Windows.SDK.Contracts.10.0.18362.2005\build\Microsoft.Windows.SDK.Contracts.targets(4,5): error : Must use PackageReference</p>
  </blockquote>
  <p>Here's what I did:</p>
  <p>Install-Package Microsoft.Windows.SDK.Contracts</p>
  <p>with references to:</p>
  <ul>
  <li>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.WindowsRuntime.dll,</li>
  <li>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.dll</li>
  <li>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Threading.Tasks.dll</li>
  <li>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.IO.dll</li>
  <li>C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades\System.Runtime.InteropServices.WindowsRuntime.dll.</li>
  </ul>
  <p>Is it maybe a thing with the .NET version? In the project's packages.config there is 4.6 while the project targets 4.5.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;packages&gt;
  &lt;package id=&quot;Microsoft.Windows.SDK.Contracts&quot; version=&quot;10.0.18362.2005&quot; targetFramework=&quot;net45&quot;/&gt;
  &lt;package id=&quot;System.Runtime.WindowsRuntime&quot; version=&quot;4.6.0&quot; targetFramework=&quot;net45&quot; /&gt;
  &lt;package id=&quot;System.Runtime.WindowsRuntime.UI.Xaml&quot; version=&quot;4.6.0&quot; targetFramework=&quot;net45&quot; /&gt;
  &lt;/packages&gt;
  </code></pre>
  <p>There are no compile errors... only this strange &quot;PackageReference&quot; error.</p>