microsoft / msix-packaging

MSIX SDK
MIT License
963 stars 163 forks source link

[BUG] Cannot even build pipeline for WPF / .NET 6 solution #534

Open bgillet opened 1 year ago

bgillet commented 1 year ago

Project MSIX Packaging Azure extension

Describe the bug I used Visual Studio 2022 with latest .Net 6 stable version to create a solution containing a simple WPF project with another MSIX packaging project. I created a repository on Azure DevOps for this solution and created a build pipeline using the MSIX Build And Package extension as explained in the documentation. When pipeline is running, it cannot build the solution because even using a windows-latest agent and indicating latest in msbuildVersion parameter. It doesn't recognize project files format.

image

When looking at the output of the extension, we can see it is not using the latest version of msbuild and msbuildVersion is limited to version 16. Which is not enough for building .NET 6 application.

When I try to reproduce what does the extension using MSBuild extension, I can go further but it fails during compilation with error message below.

image

[error]C:\hostedtoolcache\windows\dotnet\sdk\6.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets(267,5): Error NETSDK1004: Assets file 'D:\a\1\s\Test.Wpf\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.

Here is the pipeline YAML used to build the solution with the MSIX packaging extension:

name: '$(Build.DefinitionName)_$(Build.SourceBranchName)_$(Date:yyyy.M.d).$(Rev:r)'

trigger:
- '*'

pool:
  vmImage: windows-latest

steps:

- task: VersionDotNetCoreAssemblies@2
  inputs:
    Path: '$(Build.SourcesDirectory)'
    VersionNumber: '$(Build.BuildNumber)'
    Injectversion: False
    VersionRegex: '\d+\.\d+\.\d+\.\d+'
    FilenamePattern: '.csproj'
    AddDefault: true
    OutputVersion: 'AppVersion'

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '6.x'

- task: MsixPackaging@1
  inputs:
    outputPath: '$(Build.ArtifactStagingDirectory)'
    solution: '**/*.sln'
    clean: false
    generateBundle: false
    buildConfiguration: 'release'
    buildPlatform: 'Any CPU'
    updateAppVersion: true
    manifestFile: 'Test.Msix/Package.appxmanifest'
    appVersion: '$(Date:yyyy.M.d).$(Rev:r)'
    appPackageDistributionMode: 'SideloadOnly'
    msbuildLocationMethod: 'version'
    msbuildVersion: 'latest'
    msbuildArchitecture: 'x64'

And here is the one used to build the solution using VSBuild extension:

name: '$(Build.DefinitionName)_$(Build.SourceBranchName)_$(Date:yyyy.M.d).$(Rev:r)'

trigger:
- '*'

pool:
  vmImage: windows-latest

steps:

- task: VersionDotNetCoreAssemblies@2
  inputs:
    Path: '$(Build.SourcesDirectory)'
    VersionNumber: '$(Build.BuildNumber)'
    Injectversion: False
    VersionRegex: '\d+\.\d+\.\d+\.\d+'
    FilenamePattern: '.csproj'
    AddDefault: true
    OutputVersion: 'AppVersion'

- task: UseDotNet@2
  inputs:
    packageType: 'sdk'
    version: '6.x'

- task: VSBuild@1
  inputs:
    solution: '**\*.sln'
    msbuildArgs: '/p:UapAppxPackageBuildMode=SideloadOnly /p:AppxPackageSigningEnabled=false /p:AppxBundle=Never /p:AppxPackageOutput=$(Build.ArtifactStagingDirectory)'
    configuration: 'Release'
    platform: 'Any CPU'
    msbuildArchitecture: 'x64'
    logProjectEvents: false