Issues related to all development environments

Could not resolve SDK "Uno.Sdk"

This error may happen for multiple reasons:

  • Ensure that all NuGet feeds are authenticated properly. When building on the command line, some enterprise NuGet feeds may not be authenticated properly.
  • Ensure that no global package mappings are interfering with nuget restore. To validate that no package mappings are set, on Windows for Visual Studio 2022:
    • Make a backup copy of %AppData%\NuGet\NuGet.Config
    • Open a visual studio instance that does not have any solution opened
    • Go to Tools, Options, NuGet Package Manager, then Package Source Mappings
    • If there are entries in the list, click then click Remove All

Try building your project again.

Runtime error No parameterless constructor defined for XXXX

This error is generally caused by some missing IL Linker configuration on WebAssembly. You may need to add some of your application assemblies in the LinkerConfig.xml file of your project. You can find additional information in the documentation.

Similar error messages using various libraries:

  • Don't know how to detect when XXX is activated/deactivated, you may need to implement IActivationForViewFetcher (ReactiveUI)

Cannot build with both Uno.WinUI and Uno.UI NuGet packages referenced

This issue generally happens when referencing an Uno.UI (using UWP APIs) NuGet package in an application that uses Uno.WinUI (Using WinAppSDK APIs).

For instance, if your application has <PackageReference Include="Uno.WinUI" in the csproj files, this means that you'll need to reference WinUI versions of NuGet packages.

For instance:

  • Uno.UI -> Uno.WinUI

Abnormally long build times when using Roslyn analyzers

It is a good practice to use Roslyn analyzers to validate your code during compilation, but some generators may have difficulty handling the source generated by the Uno Platform (one notable example is GCop). You may need to disable those for Uno projects or get an update from the analyzer's vendor.