Reputation: 2460
I've run into a strange problem I just can't wrap my head around.
Any UWP project I build (using Visual Studio 2019, Windows 10 build 19042.1052, .NET 5.0) will:
This includes even the built-in "Blank UWP App" project, with zero changes made. I'll start a new project from the template, hit Build as soon as the window is ready, run the result, and it'll crash.
The Windows Event Viewer reports the following information:
Faulting module name: KERNELBASE.dll
, version: 10.0.19041.1023
, time stamp: 0xcbf6f7d1
Exception code: 0xe0434352
Fault offset: 0x0012a6f2
and
Exception Info: System.IO.FileNotFoundException
I have not been able to figure out how to catch that exception. I've wrapped the App
class constructor in a try...catch block and tried to catch System.IO.FileNotFoundException
there, but it doesn't seem to catch anything.
Invoking MSbuild from the command line has the same result.
I have spent all day trying to figure out what could be going wrong, uninstalling and reinstalling SDKs, trying to pare projects down to the absolute minimum to see if anything can build, but no. The only clue I've maybe found all day is that the .csproj file includes these lines:
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
It says 14.0, though my Visual Studio version is 16.10; C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\WindowsXaml\ has a folder 'v16.0' but nothing for v14.0, and an error regarding that WindowsXaml reference's non-existence shows up when I run dotnet build
(but not msbuild
...). Making a copy of it called v14.0 doesn't help though, nor does editing the csproj file.
What could I be missing?
Upvotes: 1
Views: 169
Reputation: 582
Crash immediately upon execution of the successfully-built executables.
You cannot run executable directly. When you debug uwp application, the app will be installed in local machine. You can open it in start menu. If you want to open it in other machine, you need to package it:Package a desktop or UWP app, then install it.
The similar thread: Can't run UWP release executable outside of Visual Studio 2017
Upvotes: 1