uno
uno copied to clipboard
Empty template fails on windows
Current behavior
When creating a project via the template wizard, the generated AppHead.xaml fails to load AppResources.xaml on Windows and crashes with a XamlParseException.
This seems to be a Windows issue, as running the project on Android is successful (or at least, it starts up without crashing).
Expected behavior
The template should be able to run on all platforms if the user has not changed it.
How to reproduce it (as minimally and precisely as possible)
- Create an Uno app via dotnet new
dotnet new unoapp -o WinTest -id "com.companyname.WinTest" -pub "O=WinTest" -platforms "android" -platforms "windows" -pwa False -theme "fluent" -presentation "none" -config false -di false -log "none" -nav "blank" -http false -loc false -server false -tests "none" -toolkit false -dsp false - Attempt to run the Windows head (unpackaged or UWP)
- The app will crash. If a debugger is attached, it should break at the
AppHead.g.i.cs's unexpected exception handler with a XamlParseException
The text associated with this error code could not be found.
Cannot locate resource from 'ms-appx:///WinTest/AppResources.xaml'. [Line: 12 Position: 29]
Workaround
Removing ms-appx:///WinTest/AppResources.xaml from AppHead.xaml allows the app to start up, but it also causes the AppResources to not be loaded so it's not a "real" workaround
Works on UWP/WinUI
No
Environment
Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
| Package | Version |
|---|---|
| Microsoft.Windows.SDK.BuildTools | 10.0.22621.2428 |
| Microsoft.WindowsAppSDK | 1.4.240211001 |
| Uno.WinUI | 5.1.50 |
| Uno.WinUI.DevServer | 5.1.50 |
| Uno.Sdk | 5.1.50 |
Affected platforms
Windows
IDE
Rider Windows
IDE version
2023.3.3
Relevant plugins
| Plugin | Version |
|---|---|
| Rider Xamarin Android Support | 233.14015.60 |
Anything else we need to know?
No response
@Vespion thanks for the report. We fixed this in later versions of Uno. Can you upgrade to the latest version and let us know?
I've updated all the packages, now I'm seeing an error during build
CONSOLE: Use build tool: C:\Program Files\dotnet\sdk\8.0.201\MSBuild.dll 18:10:35 Building I:\Programming\WinTest\WinTest.Windows\WinTest.Windows.csproj 18:10:35 Building I:\Programming\WinTest\WinTest\WinTest.csproj
...
Applying NuGet packaging workaround for dependent PRI files exclusion 0>MrtCore.PriGen.targets(913,5): Error MSB4062 : The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\8.0.201\Microsoft\VisualStudio\v17.0\AppxPackage\\Microsoft.Build.Packaging.Pri.Tasks.dll. Could not load file or assembly 'C:\Program Files\dotnet\sdk\8.0.201\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.Packaging.Pri.Tasks.dll'. The system cannot find the path specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
I think this might be similar #12013? However, I'm not sure how you're supposed to run the project through the IDE in that case.
Thanks for the update. This is indeed the same error, but this should not be a problem using Visual Studio. How do you get to this ? Do you use F5 to get this error?
No, I've been using the Unpackaged Application run configuration in Rider.
VS does work when using F5. I assumed this might be because VS calls MSBuild, not the dotnet CLI, but after checking, I noticed that Rider calls MSBuild directly, too.
No, I've been using the Unpackaged Application run configuration in Rider.
VS does work when using F5. I assumed this might be because VS calls MSBuild, not the dotnet CLI, but after checking, I noticed that Rider calls MSBuild directly, too.
I find the Rider's bug. Rider will use .NET Framework debugger to debug the application when I select the msbuild to build the project.