-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Users require .NET 8 to be downloaded separately to run WinUI app #19763
Comments
I don't think this is specific to MAUI apps running on WinUI, this is a condition of running WinUI apps in general. WinUI apps, as far as I'm aware, don't bundle a .NET runtime and don't support things like NativeAOT right now, so you would need to have a .NET Runtime installed in order to run them. If WinUI doesn't support it, MAUI can't. This should probably be addressed in https://github.com/microsoft/WindowsAppSDK/. @mattleibow @jonathanpeppers what do you all think? Am I missing something here? |
I think you may need SelfContained and not PublishSingleFile |
@drasticactions Based on my research, packaged WinUI apps have been able to bundle .NET with it for a long time. If they weren't able to, I think there would basically be no WinUI apps on the store/they wouldn't do very well because users would need to go download something extra outside of the store to get them to run. At a time, unpackaged WinUI apps didn't support including .NET but I think that has changed over the past year or so. @mattleibow I've given that suggestion a try and got this error message:
I've tried various remixes of it with other csproj, directory.build.targets, and command line settings in the pipeline + got the above error message and this one too:
Are these two scenarios confirmed working:
Is there a sample repository with example pipelines for these scenarios where the above has been tested in .NET8? I'm happy to pour over it and find the difference of what I'm doing wrong in my project + report back. At the moment, I feel like I'm deep in workarounds and I'm not sure if they are helping or hindering. The most success I've gotten so far is building a packaged app that does not bundle .NET & building an unpackaged app that does not start. |
When I setup my app to try debug the unpackaged app that crashes on startup (uncertain if .NET is properly bundled, I will need to get it starting first and then test on another machine), I get this error message in the console:
I was able to set a debugger for my app by following the instructions in these two links: https://learn.microsoft.com/en-us/visualstudio/debugger/debug-multiple-processes?view=vs-2022#BKMK_Automatically_start_an_process_in_the_debugger and using Auto 1 https://learn.microsoft.com/en-us/windows-hardware/drivers/debugger/enabling-postmortem-debugging#specifying-a-postmortem-debugger Interestingly, with the debugger attached, the app actually can proceed past this error and will run (albeit in a very broken state with missing icons and occasional errors + broken functionality). |
@BurkusCat would you be able to try this with a non-MAUI WinUI app? If that shows the same behavior, then you will probably have more luck on the WinAppSDK repo. I doubt this is specific to .NET MAUI. |
Hi @BurkusCat. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Publish of my .NET 8 / WinUI 3 application as MSIX with self contained .NET and Windows SDK works correct: I used this to create the MSIX:
This seems to be a MAUI related issue. |
Any update on this? |
I've created a public, GitHub fork of "maui-samples" where I've created a pipeline for the sample "weathertwentyone" app: https://github.com/BurkusCat/maui-samples/releases/tag/windows%2F1.6.1 This repo has the source code for the issue (various tags with various attempts and the |
I've tried experimenting with this again and got a reliable working solution for both packaged + unpackaged apps. I'm going to close this issue in favour of a documentation improvement issue: dotnet/docs-maui#2086 I've created a PR with working, example pipelines for anyone who needs a reference: dotnet/maui-samples#442 |
@BurkusCat Thank you for the information. I was able to build my MAUI 8.0.7 app and published it successfully on the Microsoft Store. However, the App works only on the developer machine. It does not start on a “fresh” installed Windows 10 22H2 (with all updates applied). I checked which DLLs are loaded by my App on the developer machine via Process Explorer. It loads DLLs from
Loading .NET assemblies from YourPhone folder seems very strange to me. I believe the Have you tried this once? Update: Update 2: <WindowsAppSDKSelfContained>True</WindowsAppSDKSelfContained> Note: First I added the CLI argument
|
@omghb I have not come across this problem when using Packaged or Unpackaged apps. Packaged apps include the dependency in its build output folder: And unpackaged apps include the .dlls with the build output: Out of curiosity, were you getting the issue with packaged or unpackaged apps? Were you missing the .dlls or .msixs from the screenshots above in your build output before you made that change to the |
@BurkusCat My issue was with packaged apps. My learnings:
With both parameters set I'm able to install the MSIX file and start the App on a "fresh" installed Windows 10 22H2. |
As a performance tip, for unpacked apps, set Ready2Run to true. The app will start up twice as fast. |
MSIX packaged:
Unpackaged:
Thank you @omghb for your investigation. I think the reason I never got this problem is because although I was deploying to non-dev machines, I was deploying to Windows 11 machines only which may already have the WinAppSdk? Anyway, I've started using WindowsAppSDKSelfContained for my packaged builds now too. I think in summary, it is generally a good idea to use ReadyToRunI tried using |
Apparently this has been the default since .NET 7 (#6025 (comment)). For us it was set to false in the publish profile so we saw a gain in performance after setting it to true. |
Description
When building a packaged WinUI app on a pipeline, the artifacts including with Windows runtime dependency are given to the user/customer. The user/customer runs the install PowerShell scripts which I think should install dependencies, however, when they try to launch the app, they are prompted to install the .NET 8 runtime.
Sideloading:
Directly from Microsoft Store:
After installing the runtime, the app does start. But this is a very poor user experience and won't be acceptable for the Microsoft Store. My other attempts produced builds that also required .NET8/the app failed to start.
Steps to Reproduce
Attempt 1 (packaged, mostly defaults and where I first encountered the issue):
dotnet publish -f net8.0-windows10.0.19041.0 -c:Release -p:RuntimeIdentifierOverride=win10-x64 -p:PackageCertificateThumbprint=${{ secrets.WIN_CERT_THUMBPRINT }}
App requires .NET8 runtime but it does start successfully.
Generally, I had been following instructions/guidance from here: https://learn.microsoft.com/en-us/dotnet/maui/windows/deployment/publish-cli?view=net-maui-8.0
Attempt 2 (Packaged self-contained app):
dotnet publish -f net8.0-windows10.0.19041.0 -c:Release -p:RuntimeIdentifierOverride=win-x64 -p:Platform=x64 -p:PackageCertificateThumbprint=${{ secrets.WIN_CERT_THUMBPRINT }} -p:WindowsAppSDKSelfContained=true
Including all the workarounds described in: microsoft/WindowsAppSDK#4008
This produces a 49.2mb file (it actually got smaller than my previous builds of 104.4mb without
WindowsAppSDKSelfContained
). The same issue occurs and the app also crashes on startup.Crash log from app center:
Generally, I had been following instructions/guidance from here: https://learn.microsoft.com/en-us/dotnet/maui/windows/deployment/publish-unpackaged-cli?view=net-maui-8.0
Attempt 3 (Unpackaged self-contained app):
Update the csproj to have the below but kept all the changes made in Attempt 1.
The folder full of files is roughly about 230mb in size (Which sounds promising). Its an unpackaged app but I think this will be fine for me as I do need to upload this to the Steam store. Strangely, the app isn't a single file?
Folder of files
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Version 10.0.22621 Build 22621 - probably various versions
Did you find any workaround?
No
Relevant log output
No response
The text was updated successfully, but these errors were encountered: