Improve csproj OpenTapPackageReference error message
If a project is using e.g. the OpenTAP version 9.14.0 nuget package and installs a package which requires a greater OpenTAP version, you get a very confusing error message:
<OpenTapPackageReference Include="SomePackage" Repository="Not packages.opentap.io" />
13 $ dotnet build -c Release 14 Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core 15 Copyright (C) Microsoft Corporation. All rights reserved. 16 Restore completed in 402.91 ms for Plugin.csproj 18 A package dependency named 'OpenTAP' with a version compatible with ^9.15.2+39e6c2a2 could not be found in any repository. 19 Plugin.csproj(29): error OpenTAP Install: Failed to install package 'SomePackage'. To download package dependencies despite the conflicts, use the --force option. Could not find one or more packages. 20 Build FAILED. 21 Plugin.csproj(29): error OpenTAP Install: Failed to install package 'SomePackage'. To download package dependencies despite the conflicts, use the --force option. Could not find one or more packages. 22 0 Warning(s) 23 1 Error(s) 24 Time Elapsed 00:00:42.16
OpenTAP 9.15.2 is not resolved because it is not in the repository specified by this particular package, which makes sense.
We currently ignore it and avoid upgrading OpenTAP is an element like
<OpenTapPackageReference Include="OpenTAP" Version="9.16.1/> is used. We should probably also treat it like an error if installing a dependency requires an OpenTAP upgrade, and provide a concrete warning. Something like:
Plugin.csproj(29): This project was restored using OpenTAP version 9.14.0, but the requested package dependency 'SomePackage' requires OpenTAP version ^9.15.2. Please upgrade the NuGet package used in this project.