Skip to content

WindowsPackageType=None in a class library includes the bootstrapper #2456

@mattleibow

Description

@mattleibow

Describe the bug

If you set the the package type in a class library, then the build adds the bootstrapper to the class library:

<WindowsPackageType>None</WindowsPackageType>

This is because the condition to include the bootstrapper is very loose:

<PropertyGroup Condition="'$(WindowsAppSdkBootstrapInitialize)'=='' and '$(WindowsAppSDKSelfContained)'!='true' and '$(WindowsPackageType)'=='None'">

A workaround is to also set the WindowsAppSdkBootstrapInitialize property:

<WindowsAppSdkBootstrapInitialize Condition=" '$(WindowsAppSdkBootstrapInitialize)' == '' and '$(OutputType)' != 'Exe' and '$(OutputType)' != 'WinExe' ">false</WindowsAppSdkBootstrapInitialize>

Steps to reproduce the bug

  1. File | New | WinUI class library
  2. Set WindowsPackageType=None
  3. Build
  4. Inspect dll and observe bootstrapper

Expected behavior

No bootstrapper

Screenshots

No response

NuGet package version

1.0.0

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

I noticed this when several libraries referenced each other:

C:\Users\mattl.nuget\packages\microsoft.windowsappsdk\1.0.2\include\MddBootstrapAutoInitializer.cs(11,38): warning CS0436: The type 'Release' in 'C:\Users\mattl.nuget\packages\microsoft.windowsappsdk\1.0.2\buildTransitive..\include\WindowsAppSDK-VersionInfo.cs' conflicts with the imported type 'Release' in 'SkiaSharp.Views.Maui.Controls, Version=2.88.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'C:\Users\mattl.nuget\packages\microsoft.windowsappsdk\1.0.2\buildTransitive..\include\WindowsAppSDK-VersionInfo.cs'. [C:\Projects\SkiaSharp\source\SkiaSharp.Views.Maui\SkiaSharp.Views.Maui.Controls.Compatibility\SkiaSharp.Views.Maui.Controls.Compatibility.csproj]

Metadata

Metadata

Assignees

Labels

area-DynamicDependenciesDynamicDependency for Windows App SDK: enables framework packages for packaged & unpackaged appsarea-InfrastructureBuild, test, source layout, package constructionbugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions