microsoft / msix-packaging

MSIX SDK
MIT License
963 stars 163 forks source link

[BUG] MsBuild 17.0 #491

Open mtbayley opened 2 years ago

mtbayley commented 2 years ago

Project MSIX SDK DevOps Extension

Describe the bug Please allow MsBuild 17.0 to be used so we can use .Net 6 in our pipelines

C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets(134,5): warning NETSDK1182: Targeting .NET 6.0 in Visual Studio 2019 is not supported.

florelis commented 2 years ago

The MSIX Packaging task can only use the version of MSBuild that you have installed in your agent. So first you need to ensure that MSBuild 17.0 is installed.

Then, you need to point the packaging task to it. There is an input for choosing which version of MSBuild to use. You can set the msbuildLocationMethod to version (automatically find MSBuild by version; this is the default) and then set msbuildVersion to an appropriate version. We currently don't have 17.0 here, but I think latest should work. If that doesn't work, you can change msbuildLocationMethod to location and then set msbuildLocation manually.

On our side, we do need to update the MSBuild location logic to accept 17.0 as input, but this shouldn't block you as you can set the path manually.

mtbayley commented 2 years ago

Thanks, I found out later that you can set the path explicitly. I can confirm that latest will only return MSBuild 16.0

EddyHaigh commented 2 years ago

When manually referencing the msbuild version ( 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Msbuild\Current\Bin\MSBuild.exe') the packaged msix does not contain any of the package references e.g.

   <PackageReference Include="Microsoft.WindowsAppSDK" Version="[1.0.0]">
      <IncludeAssets>build</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="[10.0.22000.194]">
      <IncludeAssets>build</IncludeAssets>
    </PackageReference>
MisinformedDNA commented 1 year ago

msbuildVersion: '17.0' also doesn't work, but this does:

msbuildLocationMethod: location
msbuildLocation: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Msbuild\Current\Bin\MSBuild.exe'

Will the task be updated at some point?