Skip to content
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

Creating a singleExe from UnPackaged app breaks the latest WindowsApp SDK #4390

Open
sudharsan-narayanan opened this issue May 6, 2024 · 5 comments
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration

Comments

@sudharsan-narayanan
Copy link

sudharsan-narayanan commented May 6, 2024

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

  1. Open the SimpleApp project.
  2. 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
  3. 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

image

In Version 1.5.240428000

image

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

@ghost1372
Copy link
Contributor

ghost1372 commented May 6, 2024

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

@lhak
Copy link

lhak commented May 7, 2024

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.

@bpulliam
Copy link
Collaborator

bpulliam commented May 8, 2024

Do the suggested actions fix the problem?

@sudharsan-narayanan
Copy link
Author

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.

@ghost1372
Copy link
Contributor

@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
Screenshot 2024-05-08 193229

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.

@codendone codendone added area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration and removed needs-author-feedback labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-DeveloperTools Issues related to authoring (source and IDL), debugging, HotReload, LiveVisualTree, VS integration
Projects
None yet
Development

No branches or pull requests

5 participants