Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error MSB4062: The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" #4889

Open
dotMorten opened this issue Nov 15, 2024 · 5 comments
Open
Assignees

Comments

@dotMorten
Copy link
Contributor

dotMorten commented Nov 15, 2024

Describe the bug

Having some class libraries that reference each other, and the head app ends up failing to compile with an unhelpful error:

E:.nuget\packages\microsoft.windowsappsdk\1.6.240923002\buildTransitive\MrtCore.PriGen.targets(914,5): error MSB4062: The "Microsoft.Build.Packaging.Pri.Tasks.ExpandPriContent" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\9.0.100\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.Packaging.Pri.Tasks.dll. Could not load file or assembly 'C:\Program Files\dotnet\sdk\9.0.100\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.Packaging.Pri.Tasks.dll'. The system cannot find the path specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Reproduced with both .NET 9.0.100 and .NET 8.0.404, so doesn't appear to be a .NET 9 regression. Can also reproduce with both 1.5 and 1.6 of the SDK

The missing file doesn't exist. I wonder if it was supposed to evaluate to: "c:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VisualStudio\v17.0\AppxPackage\Microsoft.Build.Packaging.Pri.Tasks.dll" instead ?

Steps to reproduce the bug

  1. Unzip the following project: winappsdkrepro.zip
  2. Open and compile it. Notice that the MAUI application fails to compile with the above error.

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.6.2: 1.6.241106002

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

I can also reproduce this from commandline if I use dotnet build. However I don't reproduce from commandline if I use msbuild /restore CalciteDotNet.sln /t:Build, leading me to believe that when compiling from within Visual Studio, it doesn't use msbuild.

@dotMorten
Copy link
Contributor Author

Potentially related to dotnet/maui#5886 @mattleibow

@haonanttt
Copy link
Contributor

Hi @dotMorten , could you help double confirm whether this issue still occurs?

From my repro, i build the solution and everything works well
Image

@dotMorten
Copy link
Contributor Author

@haonanttt was there a version released where this was fixed?

@haonanttt
Copy link
Contributor

@dotMorten but i didn't do any changes (I mean I didn't do any updates to any of the dependent packages) to the zip file you uploaded, so I believe I'm using the same version with you. Suspect whether this was some transient issue or can only happen on specific machine environment, so would like to seek a double confirm to see whether you still encounters this error.

@haonanttt
Copy link
Contributor

Hi @dotMorten , sorry for missing the key part that you mentioned this issue happens only for dotnet build...

According to https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/release-notes-archive/experimental-channel-1.2#other-limitations-and-known-issues, this is a known issue since 1.2 and could be resolved by adding <EnableMsixTooling>true</EnableMsixTooling> in your project file.

I've repro the issue using dotnet build and verified the <EnableMsixTooling>true</EnableMsixTooling> works, please have a try. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants