Skip to content

App update to 1.8-preview1 with errors #5746

Closed

Description

@Sella-GH

Describe the bug

When updating my app to the newest 1.8-preview1 version I am encountering the following errors:
NETSDK1022: Duplicate 'PRIResource' items were included. [...] // Not that relevant because of easy fix w/ the property
NETSDK1022: Duplicate 'Page' items were included. [...] // Not that relevant because of easy fix w/ the property
WMC1012: A project cannot have more than one ApplicationXaml item

Steps to reproduce the bug

  1. Setting the version of Microsoft.WindowsAppSDK package to 1.8.250814004-preview
  2. dotnet restore
  3. dotnet build

Expected behavior

A clean compile w/o any unrelated/unexpected error or warning regarding the .NET SDK or ApplicationXaml.

Screenshots

No response

NuGet package version

Windows App SDK 1.8 Preview 1: 1.8.250814004-preview1

Packaging type

Unpackaged

Windows version

Windows 11 version 24H2 (26100, June 2025 Update)

IDE

Visual Studio 2022-preview

Additional context

.NET SDK: 9.0.304

I also tried compiling with the EnableDefaultPriItems and EnableDefaultPageItems set to false but then it still throws the error regarding the ApplicationXaml.

The issue affects both the meta package and the individual packages.

Activity

  1. added
    area-Packaging
    on Aug 25, 2025
  2. ssparach commented on Aug 28, 2025

    @ssparach
    Contributor

    Thanks for reporting this!

    Could you please share a minimal repro sample here to help us investigate further? Also, is the application being built out-of-source or within-source? The project properties can be helpful if built within source.

    Appreciate your input—thank you!

  3. Sella-GH commented on Aug 28, 2025

    @Sella-GH
    Author

    Thanks for replying! I could narrow the issue down now. I think my NuGets were just scrabbled and confused... I removed the EnableDefaultPriItems and EnableDefaultPageItems properties again and now it finally compiles.

    Although I got the .pri file issue now as mentioned in #5749. When starting my app, it quickly fails with a COM Exception:

    System.Runtime.InteropServices.COMException (0x80070490): Element not found.
    
    Element not found.
    
       at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|41_0(Int32 hr)
       at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
       at ABI.Microsoft.Windows.ApplicationModel.Resources.IResourceMapMethods.GetValue(IObjectReference _obj, String resource, ResourceContext context)
       at Microsoft.Windows.ApplicationModel.Resources.ResourceMap.GetValue(String resource, ResourceContext context)
    

    This happens when I try to get a localized string from my .resw files which contain the language-specific strings.

    Manually copying the Microsoft.WindowsAppSDK.pri file does not help in this case, so I suppose the strings of our own .resw files aren't included in the resulting .pri.

    Arch: x64
    Configuration: Debug / Release
    CsWinRT Version: 2.3.0-preview (an issue? 1.7.x worked fine tho)

  4. DarranRowe commented on Aug 28, 2025

    @DarranRowe

    I think there is a second .pri file that is missing with the single project packaging. I'll do a quick check to verify which file it is.

    Yeah, in the external packaging project, there is resources.pri, Microsoft.WindowsAppRuntime.pri, Microsoft.UI.Xaml.Controls.pri and Microsoft.UI.pri. Only resources.pri exists in the single packaging project. Does manually copying Microsoft.UI.Xaml.Controls.pri and Microsoft.UI.pri along with Microsoft.WindowsAppRuntime.pri help?

    Otherwise, could you use makepri to dump the contents of resources.pri?

  5. Sella-GH commented on Aug 28, 2025

    @Sella-GH
    Author

    Ehh to make the confusion a little less (I hope). I use the Unpackaged approach with SelfContained and PublishNativeAot.

    When I publish the app then all of the .pri files (AppName.pri, Microsoft.UI.pri, Microsoft.UI.Xaml.Controls.pri and Microsoft.WindowsAppRuntime.pri) are there. There is no dedicated resources.pri available only the mentioned four.

    When I dump the content of the AppName.pri then I can see all of my resources... that's weird.

  6. DarranRowe commented on Aug 29, 2025

    @DarranRowe

    I apologise, I missed the fact that you had unpackaged in the report, and then you referenced #5749. This caused me to assume packaged.

    #5749 is caused by the packaging process. It is easy to see this if you inspect the output. To give an example of this:

    Image

    This is the output of a C++ project after building but before packaging. All of the .pri files are accounted for. The single project tooling goes straight for resources.pri since the output is assumed to be a package. However:

    Image

    after the package layout is created, only resources.pri exists in the package directory.

    The packaging steps do not run when the application is unpackaged. So the issue that occurs in #5749 just cannot happen.

    Is it possible to use the resource manager API to iterate through your resources? Something could have happened that resulted in the resource name changing.

  7. Sella-GH commented on Aug 29, 2025

    @Sella-GH
    Author

    Thanks for the tip with the Resource Manager... I had a language service which had hardcoded the resources.pri file because in 1.7.x of WASDK there was indeed one but in 1.8.x there isn't. Now the .pri file is named the same as your application .exe filename which is somewhat weird.

    Either I've overlooked this in the changelog or it wasn't mentioned but this is a little breaking imho.

    When I changed the string to match the new name it works completely fine.

  8. DarranRowe commented on Aug 29, 2025

    @DarranRowe

    Have you always used the template with the single project packaging?

    I think I remember that when that was enabled in a project, then it would blindly rename or just use resources.pri. The build system in general always used the executable name.

    As a bit of an experiment, for the version that uses 1.7 or older, edit the .csproj/.vcxproj file and remove EnableMsixTooling from the project properties and see what happens to the .pri file in an unpackaged project.

  9. Sella-GH commented on Aug 29, 2025

    @Sella-GH
    Author

    Yes I've always used the default template and only extended / adjusted it where I needed to.
    When removing the EnableMsixTooling property using 1.7 then the COMException throws again, probably like it was intended the first place.

    It now also uses the AppName.pri instead of resources.pri. That's interesting.

  10. DarranRowe commented on Aug 29, 2025

    @DarranRowe

    Basically, it seems like you have been caught by a long running bug in the older versions of the MSIX tooling that backs the single packaging project where it didn't respect the unpackaged setting, and used resources.pri regardless. The newer version 1.8 uses seems to fix this.

    ssparach

    Just to confirm, is the generation of resources.pri in older versions when EnableMsixTooling is set to true and WindowsPackageType set to none unintended?

    --Edit--

    To illustrate what I mean, consider the following four files.

    ResTest-1.7-NoMsixTooling.zip

    ResTest-1.7-MsixTooling.zip

    ResTest-1.8p-NoMsixTooling.zip

    ResTest-1.8p-MsixTooling.zip

    They are four copies of the same project. It was made using the WinUI Blank App (Packaged with Windows Application Packaging Project) template, but I removed the packaging project since it is not needed here. The .vcxproj file has WindowsPackageType set to none. WindowsAppSDKSelfContained is not set since it doesn't change the output, but just makes the output directory bloated.

    The first copy references 1.7.3. The second copy references 1.7.3 and enables the Single-project MSIX Packaging Tools extension using EnableMsixTooling. The third copy references 1.8-preview. The fourth copy references 1.8-preview and enables the Single-project tools in the Microsoft.Windows.SDK.BuildTools.MSIX using EnableMsixTooling.

    For the first copy, the .pri file is named ResTest.pri.
    For the second copy, the .pri file is named resources.pri.
    For the third copy, the .pri file is named ResTest.pri.
    For the fourth copy, the .pri file is named ResTest.pri.

  11. added
    area-MSIXBuildTools
    and removed
    area-Packaging
    on Mar 12, 2026
  12. added
    needs-area-owner-attention
    and removed on Sep 28, 2026
  13. guimafelipe commented on Oct 1, 2026

    @guimafelipe
    Contributor

    Closing this one as fixed. It is not reproducing on current version 1.7.260930100.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-MSIXBuildToolsneeds-area-owner-attention

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions