microsoft / microsoft/WindowsAppSDK

`Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll` is included in output of framework-dependent unpackaged app

Open
#5,398 3 comments 3 reactions 0 assignees View on GitHub
area-BackgroundTask area-WinAppSDKDeployment
Dominant language
C++
Stars
4.7k
Forks
471
Avg merge
3d 13h
Merged PRs (30d)
28

Description

### Describe the bug

`Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll` is copied to the publish output of unpackaged apps, despite not being relevant (it only applies to packaged apps).

### Steps to reproduce the bug

1. Create a new C# app using the `WinUI Blank App (Packaged)` template
2. Add `None` to the csproj
3. (optional) Enable NAOT by also adding `true` and upgrading the target framework to .NET 9 (this removes a lot of stuff from the output, making the issue more apparent)
4. Set the build configuration to `Release` in VS
5. In the solution explorer, right click on the project and hit publish. Then in the window that opens, hit publish, and once it finishes, hit navigate to open the published directory
6. Observe the presence of `Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll`

### Expected behavior

This DLL should not be present

### Screenshots

![Image](https://github.com/user-attachments/assets/c17261b4-b70c-43c7-8807-fd72fb083807)

### NuGet package version

Windows App SDK 1.7.1: 1.7.250401001

### Packaging type

Unpackaged

### Windows version

Windows 11 version 24H2 (22621, October 2024 Update)

### IDE

Visual Studio 2022-preview

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the project's .csproj and reproduce the Release publish using the six steps in the issue, then trace which publish or packaging entry point adds Microsoft.Windows.ApplicationModel.Background.UniversalBGTask.dll. Compare unpackaged and packaged outputs; done means the DLL is absent from the unpackaged publish output while the relevant packaged behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
build-system, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.