dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.24k stars 1.35k forks source link

[Bug]: CI/CD pipeline broken after update from 17.9 to 17.10: no Appx packages generated #10182

Closed JochemPalmsens closed 5 months ago

JochemPalmsens commented 6 months ago

Issue Description

We're running a Github action for our release branches that builds, signs and uploads our apps to the app center. Yesterday we updated the build tools from 17.9 to 17.10 and now the pipeline is broken.

As a build step, the action issues the command:

msbuild [our app name].sln /t:Apps\[our app identifier] /p:Platform=x64 /p:Configuration=ReleaseDeployment /p:PackageVersion=1.2.0.203 /p:AppxBundlePlatforms=x64 /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:AppxPackageSigningEnabled=False "/p:AppxPackageDir=E:\1\trunk\trunk/AppxPackages/" /m

this used to generate the artifacts in the directory E:\1\trunk\trunk\AppxPackages\ with version 17.9, however, with version 17.10 the directory isn't generated at all. So the next steps fail as the files aren't found.

I've been looking around for a breaking change in 17.10, but found nothing. I've also tried to "fix" the inconsistent slashes in the path, but that didn't matter (and 17.9 worked fine). So I guess this is a bug?

Steps to Reproduce

msbuild [our app name].sln /t:Apps\[our app identifier] /p:Platform=x64 /p:Configuration=ReleaseDeployment /p:PackageVersion=1.2.0.203 /p:AppxBundlePlatforms=x64 /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:AppxPackageSigningEnabled=False "/p:AppxPackageDir=E:\1\trunk\trunk/AppxPackages/" /m

I cannot share the code, as it's IP. But if this is actually broken, more people should quickly discover this, right? Seems quite essential.

Expected Behavior

msbuild generates the .msix file in the E:\1\trunk\trunk/AppxPackages/ (sub) directories.

Actual Behavior

The E:\1\trunk\trunk/AppxPackages/ is not being generated at all.

Analysis

No response

Versions & Configurations

MSBuild version 17.10.4+10fbfbf2e for .NET Framework 17.10.4.21802

JochemPalmsens commented 6 months ago

OK, small update here. I've taken the WinUI3 default template project and ran the same command. I got the following output: afbeelding

Now back to my CI/CD pipeline: it seems that is no longer running these "_GenerateAppxPackageFile:" steps: afbeelding

It just stops after the _CreateR2RImages: step.

Was there a breaking change in a previous version that I missed, and for which the support was dropped?

JochemPalmsens commented 6 months ago

Never mind: this is probably not a bug (I was "blamed" for this, as I had updated the VS version on the build server.)

Turned out that it was caused by somebody adding MAUI components to out WinUI3 project and updating the csproj file.

<Project Sdk="Microsoft.NET.Sdk"> was changed to <Project Sdk="Microsoft.NET.Sdk.Razor"> and these lines were added

      <UseMaui>true</UseMaui>
      <MauiEnablePlatformUsings>true</MauiEnablePlatformUsings>
      <SingleProject>true</SingleProject>
      <EnableDefaultCssItems>false</EnableDefaultCssItems>

one of these broke the CI/CD pipeline as the msix files aren't generated. Still, the app runs fine... so why aren't the appx packages generated?

surayya-MS commented 5 months ago

@JochemPalmsens, I'm happy to hear that you managed to find the problem. Given that this not a MSBuild bug, closing this issue.

Note: changing the project sdk most likely is the problem a problem. I cannot tell for sure without seing the project file. Microsoft.NET.Sdk fully supports WinUI3 projects, whereas Microsoft.NET.Sdk.Razor is not designed for desktop applications like WinUI3. The Razor SDK is meant for web applications and might cause build errors or unexpected behavior when used in a WinUI3 project.