Repository navigation
Description
Summary
When the Uno.Sdk version pinned in global.json is not in the local NuGet cache, uno.devserver disco gives the same answer in two different situations:
- the version simply hasn't been restored yet (a restore will fix it);
- the version can't be restored from the configured sources at all (for example, a version that only exists on a private or internal feed).
The error doesn't say which case applies:
"unoSdkVersion": "6.7.12",
"unoSdkPath": null,
"errors": [ "Uno SDK package not found in NuGet cache: Uno.Sdk 6.7.12." ]The CLI exits with code 1 and the dev server never starts. IDEs show this string as is, so the user can't tell that the fix is to change global.json.
Repro
- Pin a
Uno.Sdkversion inglobal.jsonthat isn't on nuget.org (here6.7.12; the public 6.7 versions are 6.7.18, 6.7.22 and 6.7.30). - Use an empty NuGet cache and a
nuget.configcontaining only nuget.org. dotnet dnx -y uno.devserver -- disco --solution <app>.sln --json→ exit 1 after about 10 s, with the error above.
For comparison, MSBuild's SDK resolver on the same project gives the actionable message:
Unable to find package Uno.Sdk with version (= 6.7.12)
- Found 1473 version(s) in nuget.org [ Nearest version: 6.7.18 ]
error MSB4236: The SDK 'Uno.Sdk' specified could not be found.
With global.json set to 6.7.30 and after a restore, disco succeeds (dev server 6.7.135, net10.0 host).
Proposal
In UnoToolsLocator (EnsureNugetPackage(..., tryInstall: false), src/Uno.UI.DevServer.Cli/Helpers/UnoToolsLocator.cs:95-101), when Uno.Sdk is missing from the cache:
- Check the configured sources (the
NuGet.Confighierarchy of the solution) for the pinned version. - Report one of two distinct outcomes:
- not restored yet: "Uno.Sdk X is not restored yet. Run
dotnet restoreor build the solution." - unavailable: "Uno.Sdk X is not available on any configured NuGet source (nearest: Y). Update
msbuild-sdksinglobal.json."
- not restored yet: "Uno.Sdk X is not restored yet. Run
- Add a machine-readable code next to the message in the JSON payload (for example
errorCodes: ["UnoSdkNotRestored" | "UnoSdkUnavailable"]). IDE extensions could then show a specific message and send a reason category in their telemetry, without parsing English text.
The same split applies to Uno.WinUI.DevServer not found in NuGet cache.
Why
Today the only signal is a generic "not found in cache". The extension and the in-app tooling end up showing generic messages ("could not be started", "server unreachable"), and the user spends time on IDE/workload troubleshooting (uno-check, reinstalling the extension) instead of fixing one line in global.json.
Activity