WindowsAppSDK
WindowsAppSDK copied to clipboard
Resource files not copied to publish directory once app upgraded to Windows App SDK 1.5
Describe the bug
When publishing an unpackaged app configured to publish as a single file using the latest stable version of the 1.5 App SDK, the resource files are not copied to the publish directory as they were when using Windows App SDK v1.4. This includes any assets set to copy always, the resources.pri and bootstrap dll.
This causes the published app to be unable to launch when using v.1.5.
I notice that there is a warning generated during the build and publish for a 1.5 app. Is there a new way that we're supposed to achieve this? I would really prefer to publish my app as a single exe, if possible.
PublishSingleFile is recommended only for Windows App SDK Self-Contained apps:
<PropertyGroup>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
</PropertyGroup>
Steps to reproduce the bug
The attached test app recreates the issue. I used this command (cribbed from our devops build agent) to publish the projects, substituting in the path to each project file:
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\msbuild.exe" "<PATH TO .csproj>" /nologo /nr:false /t:Rebuild;Publish /p:DebugSymbols=false /p:DebugType=None /p:DeleteExistingFiles=True /p:RuntimeIdentifier=win-x64 /p:PublishSingleFile=True /p:SelfContained=False /p:NuGetInteractive=True /p:platform="x64" /p:configuration="Release" /p:VisualStudioVersion="17.0"
It will likely be necessary to restore the nuget packages before running this command.
Expected behavior
Expect that the resource files should be copied to the publish directory so that the app is able to run.
Screenshots
1.4 output:
1.5 output:
NuGet package version
Windows App SDK 1.5.5: 1.5.240627000
Packaging type
Unpackaged
Windows version
Windows 10 version 21H2 (19044, November 2021 Update)
IDE
Visual Studio 2022
Additional context
No response
Could this be related to #4390 ?
Looking at it, it could very well be. Thanks! I'll go through the suggested steps and see if it helps in our case.
OK, so setting <WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained> on the 1.5 test project and publishing as /p:SelfContained=True makes it so that the published app is able to be launched.
Is the plan, then, that it will only be possible in future to publish as a single file if the app is self contained? Fine, if so. I just need to make a decision which way to go.
I believe it was <EnableMsixTooling>true</EnableMsixTooling> that messes with the copying of the resource file.
@jabberscript Please note that PublishSingleFile deployment model is a new feature introduced in WindowsAppSDK 1.5. See release notes here.
As your testing project is an unpackaged app, you will need to set WindowsAppSDKSelfContained to true. Unpackaged app do not have package identity and cannot rely on the system-wide installation of the Windows app runtime packages.
Additionally, this PublishSingleFile feature recommends setting SelfContained to be true, which will embed the .NET libraries into the executable file.
Let me know if you have any other question.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.