WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Numerous warnings about target authoring errors

Open mattleibow opened this issue 2 years ago • 0 comments

Describe the bug

When building with EnablePreviewMsixTooling=True, I get a bunch of warnings about invalid targets:

C:\Program Files\dotnet\sdk\6.0.400-preview.22301.10\Microsoft.Common.CurrentVersion.targets(44,3):
warning MSB4011: "C:\Users\mattl.nuget\packages\microsoft.windowsappsdk\1.1.1\buildTransitive\Microsoft.Build.Msix.props" cannot be imported again. It was already imported at "C:\Users\mattl.nuget\packages\microsoft.windowsappsdk\1.1.1\buildTransitive\Microsoft.WinUI.props (25,3)". This is most likely a build authoring error. This subsequent import will be ignored.

This appears to be because there is a double import in WinUI.props (L14-26:

    <!--
      The Single-project MSIX Packaging tooling needs to be imported before 
      microsoft.common.currentversion.targets has a chance to import the built-in 
      Microsoft.AppxPackage.targets file. This props file won't actually do anything if EnableMsixTooling
      isn't set to true. Doing this pattern lets users just set the property in their project file, without 
      needing to create a Directory.Build.props file and placing it there. If this doesn't work for a customer 
      because they have their own CustomBeforeMicrosoftCommonTargets (which is incredibly unlikely), we can 
      give them an escape hatch of allowing them to specify the property in a Directory.Build.props.
    -->
    <CustomBeforeMicrosoftCommonTargets Condition="'$(EnableMsixTooling)'=='' or '$(EnablePreviewMsixTooling)'=='true'">$(MSBuildThisFileDirectory)Microsoft.Build.Msix.props</CustomBeforeMicrosoftCommonTargets>
  </PropertyGroup>
  <Import Condition="'$(EnableMsixTooling)'=='true' or '$(EnablePreviewMsixTooling)'=='true'" Project="$(MSBuildThisFileDirectory)Microsoft.Build.Msix.props"/>
  <Import Project="$(XamlCompilerPropsAndTargetsDirectory)Microsoft.UI.Xaml.Markup.Compiler.props" Condition="'$(MSBuildProjectExtension)'!='.wapproj'" />

Steps to reproduce the bug

  1. File | New | Maui
  2. Build

Or

  1. File | New | WinUI
  2. Set <EnablePreviewMsixTooling>true</EnablePreviewMsixTooling>
  3. Build

Expected behavior

No warnings

Screenshots

No response

NuGet package version

1.1.1

Packaging type

No response

Windows version

No response

IDE

No response

Additional context

No response

mattleibow avatar Jun 28 '22 21:06 mattleibow