uno.toolkit.ui
uno.toolkit.ui copied to clipboard
Can build Uno targeting windows, linux and wasm when referencing Uno.Toolkit.Skia.WinUI
Current behavior
Docker image fails to build wit the following errors:
[build 7/7] RUN dotnet publish UnoShadowContainer/UnoShadowContainer.csproj -c Release -f net8.0-browserwasm -o /app/uno-publish: 4.231 Determining projects to restore... 40.90 Restored /src/UnoShadowContainer/UnoShadowContainer.csproj (in 35.97 sec). 50.60 Downloading dotnet-runtime-wasm-linux-498e18e-7331dcb60e0-8790049905-Release-simd to /tmp/dotnet-runtime-wasm-linux-498e18e-7331dcb60e0-8790049905-Release-simd.zip 71.06 /root/.nuget/packages/uno.wasm.bootstrap/8.0.21/build/Uno.Wasm.Bootstrap.targets(226,3): error : System.NotSupportedException: Failed to install emscripten [/src/UnoShadowContainer/UnoShadowContainer.csproj::TargetFramework=net8.0-browserwasm] 71.06 /root/.nuget/packages/uno.wasm.bootstrap/8.0.21/build/Uno.Wasm.Bootstrap.targets(226,3): error : at Uno.Wasm.Bootstrap.ShellTask_v038af955a9b67691b2e0a0ec4ebf87820919b6b1.ValidateEmscripten() in //src/Uno.Wasm.Bootstrap/ShellTask.cs:line 1354 [/src/UnoShadowContainer/UnoShadowContainer.csproj::TargetFramework=net8.0-browserwasm] 71.06 /root/.nuget/packages/uno.wasm.bootstrap/8.0.21/build/Uno.Wasm.Bootstrap.targets(226,3): error : at Uno.Wasm.Bootstrap.ShellTask_v038af955a9b67691b2e0a0ec4ebf87820919b6b1.RunPackager() in //src/Uno.Wasm.Bootstrap/ShellTask.cs:line 809 [/src/UnoShadowContainer/UnoShadowContainer.csproj::TargetFramework=net8.0-browserwasm] 71.06 /root/.nuget/packages/uno.wasm.bootstrap/8.0.21/build/Uno.Wasm.Bootstrap.targets(226,3): error : at Uno.Wasm.Bootstrap.ShellTask_v038af955a9b67691b2e0a0ec4ebf87820919b6b1.Execute() in /_/src/Uno.Wasm.Bootstrap/ShellTask.cs:line 270 [/src/UnoShadowContainer/UnoShadowContainer.csproj::TargetFramework=net8.0-browserwasm]
Docker file:
# Use the .NET SDK image to build the application
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
# Copy the solution file and project files
COPY *.sln .
COPY UnoShadowContainer/*.csproj ./UnoShadowContainer/
RUN dotnet restore
# Copy the rest of the source code
COPY . .
# Build the Uno WebAssembly project
RUN dotnet publish UnoShadowContainer/UnoShadowContainer.csproj -c Release -f net8.0-browserwasm -o /app/uno-publish
# Build the runtime image
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY --from=build /app/publish .
# Copy the Uno WebAssembly files to wwwroot
COPY --from=build /app/uno-publish/wwwroot ./wwwroot
# Expose port 80
EXPOSE 80
ENTRYPOINT ["dotnet", "UnoShadowContainer.dll"]
Expected behavior
Docker image should jus build successfully
How to reproduce it (as minimally and precisely as possible)
Create default uno application, add
<ItemGroup>
<PackageReference Include="Uno.Toolkit.Skia.WinUI" Version="6.1.8" />
</ItemGroup>
in .csproj so it should look like this:
<Project Sdk="Uno.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0-windows10.0.19041;net8.0-browserwasm;net8.0-desktop</TargetFrameworks>
<OutputType>Exe</OutputType>
<UnoSingleProject>true</UnoSingleProject>
<!-- Display name -->
<ApplicationTitle>UnoShadowContainer</ApplicationTitle>
<!-- App Identifier -->
<ApplicationId>com.companyname.UnoShadowContainer</ApplicationId>
<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
<ApplicationVersion>1</ApplicationVersion>
<!-- Package Publisher -->
<ApplicationPublisher>Administrator</ApplicationPublisher>
<!-- Package Description -->
<Description>UnoShadowContainer powered by Uno Platform.</Description>
<!--
If you encounter this error message:
error NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll.
Please update to a newer .NET SDK in order to reference this assembly.
This means that the two packages below must be aligned with the "build" version number of
the "Microsoft.Windows.SDK.BuildTools" package above, and the "revision" version number
must be the highest found in https://www.nuget.org/packages/Microsoft.Windows.SDK.NET.Ref.
-->
<!-- <WindowsSdkPackageVersion>10.0.22621.28</WindowsSdkPackageVersion> -->
<!--
UnoFeatures let's you quickly add and manage implicit package references based on the features you want to use.
https://aka.platform.uno/singleproject-features
-->
<UnoFeatures>
Lottie;
Hosting;
Toolkit;
Logging;
Mvvm;
Configuration;
Http;
Serialization;
Localization;
Navigation;
ThemeService;
</UnoFeatures>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Uno.Toolkit.Skia.WinUI" Version="6.1.8" />
</ItemGroup>
</Project>
use the docker file above and try to build an image: docker build -t shadow .
Nuget Package:
Package Version(s):
Affected platform(s):
- [ ] WebAssembly
IDE:
- [ ] Visual Studio 2022
Relevant plugins:
Anything else we need to know?
It works fine when building on windows or linux but fails when building in docker. Perhaps there there needs to be something installed in docker e.g emscripten ?