WindowsAppSDK
WindowsAppSDK copied to clipboard
Creating a singleExe from UnPackaged app breaks the latest WindowsApp SDK
Describe the bug
Currently using the latest SDK 1.5.240428000, it fails to generate the resource.pri
when creating the SingleExe. I think, it is breaking the latest SDK behavior.
If we use the SDK version 1.4.240211001, It creates the SingleExe properly with all dependency files.
It's replicate in the CustomControl library project also.
Steps to reproduce the bug
CustomControl.zip SimpleApp.zip
- Open the SimpleApp project.
- Tools->Commands->Developer Powershell. Use below command line for creating the SingleExe.
dotnet publish SimpleApp.sln -c Release -p:Platform=x64 -p:PublishSingleFile=true --self-contained true -p:WindowsAppSDKSelfContained=true
- Now, open the Bin folder and check the exe.
Note: Exe will not launch in launch SDK.
Expected behavior
It should launch the exe properly as like windows SDK (1.4.240211001).
Screenshots
In Version 1.4.240211001
In Version 1.5.240428000
NuGet package version
Windows App SDK 1.5.3: 1.5.240428000
Packaging type
Unpackaged
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
You can Exclude Files using:
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
I did not test new version, Its mechanism may have changed
Use IncludeNativeLibrariesForSelfExtract
or IncludeAllContentForSelfExtract
and see if it makes a difference
<IncludeNativeLibrariesForSelfExtract>false</IncludeNativeLibrariesForSelfExtract>
dotnet publish SimpleApp.sln -c Release -p:Platform=x64 -p:PublishSingleFile=true --self-contained true -p:WindowsAppSDKSelfContained=true p:IncludeNativeLibrariesForSelfExtract=false
The resources.pri file (and all other native libraries) are actually embedded into the .exe file now and extracted to a temporary directory when you start the application. I checked your sample app to see why it does not work:
-You need to set WindowsAppSdkSelfContained to true (see warning during build). -The resource APIs in the Windows namespace are apparently not compatible with this scheme, thus you need to use the ones from the Microsoft namespace.
Do the suggested actions fix the problem?
Do the suggested actions fix the problem?
Thanks for answering,
No @bpulliam, Still exe not launched when I use above suggestion given by @lhak and @ghost1372
I have attached my project application and the command which I use to generate the single exe. Please go through and could you please check my problem and provide a solution for this?
Note: I feel it is broken in latest update SDK.
@sudharsan-narayanan
i tested your project and i can say that issue is from your library!
you can see there is some error with your library
i created a new project with a new class library and i can publish app as single file and exe can be run without any issues.
@sudharsan-narayanan i tested your project and i can say that issue is from your library! you can see there is some error with your library
i created a new project with a new class library and i can publish app as single file and exe can be run without any issues.
We have tried the same with our provided sample, we can't be able to reproduce the error from our end. Can you please provide the sample which you created?
Myself also attached the video in this comment, which I have tried in my machine.
https://github.com/microsoft/WindowsAppSDK/assets/93642597/bedcfbf1-6715-49c0-9e3c-e608351be8e2
Hi Team, Any update on this?