Uno WASM could not resolve package when using DLL

229 views Asked by At

I'm working on an WASM app built with the Uno Platform, and have added a project reference that has been compiled and points to a DLL.

Now, when compiling, I get the error:

Error: Unhandled Exception: Could not resolve System.Text.Json (1, 1)
  at Driver.Resolve(String asm_name, AssemblyKind& kind) (1, 1)
  at Driver.Import(String ra, AssemblyKind kind) (1, 1)
  ...

Image of the full error message

What can I do to fix this?

1

There are 1 answers

0
Arlo On

According to Jerome Laban,

This is because there's no package reference to System.Text.Json now. If you add a reference to a dll instead of a project, this can happen because its own dependencies won't flow through.

Assembly dependencies are not supported by standard tooling. If you import a dll for which the dependency is not known, it won't work, you have to add an explicit package reference for that.

I've found that adding the missing nuget packages to the Wasm project directly fixes the issue (In my case, adding System.Text.Json to StrixMusic.Wasm.csproj).