After adding WindowsRuntime to a WinForms-project, building the project fails with Error "Must use PackageReference". The build log is more precise:
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
Here's what I did:
Install-Package Microsoft.Windows.SDK.Contracts
with references to:
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.
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Windows.SDK.Contracts" version="10.0.18362.2005" targetFramework="net45"/>
<package id="System.Runtime.WindowsRuntime" version="4.6.0" targetFramework="net45" />
<package id="System.Runtime.WindowsRuntime.UI.Xaml" version="4.6.0" targetFramework="net45" />
</packages>
There are no compile errors... only this strange PackageReference error.
Thank you for your wisdom.
VS2017/VS2019
-> Solution Explorer
-> right-click References
-> "Migrate packages.config to PackageReference"
right-click packages.config
-> "Migrate packages.config to PackageReference"