Build to UWP on Windows 11 With Visual Studio 2022 Fails not matter what settings are used.

So just trying to export to UWP for Xbox/PC done this a bunch of times in the past and no troubles but now it can't build any project old or new to UWP has that been depreciated? None of the usual setting work at all. I am using Unity LTS 2022.3.4f1, VS2022 and it doesn't work. There's nothing wrong with it. It is actually pretty optimized like I don't know what else I can do to it at this stage, but it refuses to certify online or locally. This is what it returns from online:

You must upload at least one package. If you are using market groups, then each market group must have at least one package.
You must provide a package that supports each selected device family (or uncheck the box for unsupported device families). Note that targeting the Xbox device family requires a neutral or x64 package.
You must provide a package that supports each selected device family (or uncheck the box for unsupported device families)
You must fix all package validation errors before submitting.
TestKB_1.0.0.0_x64.msix31.4 MB
Package acceptance validation error: StoreManifest.xml is invalid. Data at the root level is invalid. Line 1, position 1.

If anyone has any idea what might cause this I'm all ears this has stopped me submitting going on week 2 now.

Sorry for rambling a bit been awake for over 32 hours trying to get this to build working and I am 100% sure there is nothing broke in the code. Pretty sure I've narrowed it down to Unity Build settings or it's VS Build settings. Something has changed and I just don't know what has. Thanks for any advice:/

I don't know what that error means, but I suspect the problem is that the package manifest isn't be updated when you build the UWP project from Unity.

This is a quirk in the UWP build process, noted within the UWP Player Settings:
[quote]
Note: If you build your project on top of the existing one, Unity doesn’t overwrite the Package.appxmanifest file if it’s already present. That means if you change any of the Player settings, you need to check Package.appxmanifest. If you want to regenerate Package.appxmanifest, delete it and rebuild your project from Unity.
[/quote]

Try performing a clean build of the UWP project (from Unity) to a new/different output folder and see if that fixes the problem. If you've manually changed the Package.appxmanifest file (either directly or through VisualStudio's UI) you'll need to "port" those change over to the new VS Solution.

Thank you so much for a direction to look in. This is why I tell most people doing projects like mine to consider the wonderful community in Unity. I am testing this out to see if that helps. Again, thank you!

Well just got done attempting that to receive the exact same error. I am at a total loss what the issue is I have used URP, Unity and VS 2022 with UWP apps a ton of times and never seen this much trouble. It's gotta be something broken in the app certifaction program it works when I build and side load, as well as when played on Xbox. Works perfectly with no errors, no warnings.

Sorry building to a new folder didn't fix it; I'm also at a loss regarding this issue.

[quote]
something broken in the app certifaction program
[/quote]
That's possible or something simply changed with Cert that no longer likes the generated UWP manifest. So, here's my recommendation:

  1. Please file a Unity bug so the issue can be investigated; it could be a bug in UWP project generation
  2. Try contacting Microsoft support as they should be able to explain the issue

Although I don't know what the error means, it sounds like a misconfiguration .appxmanifest and to fix the error require making some special change to it.

I'm hitting this as well. Unity 2022.3.4f1. The validation error is correct, StoreManifest.xml inside the .appxupload > .appx does indeed have an invalid character at the start:
9138127--1269250--upload_2023-7-11_11-16-12.png

Note: StoreManifest.xml is a generated during the first build step (Unity) not the visual studio build step.

This occurs from a blank Unity project in 2022.3.4f1. I have submitted an issue report, IN-47242.

Temporary workaround (the invalid char is dropped in File.ReadAllText):

        [PostProcessBuild]
        public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
        {
            if (buildTarget != BuildTarget.WSAPlayer)
            {
                return;
            }

            string storeManifestPath = Path.Combine(path, Application.productName, "StoreManifest.xml");
            string manifest = File.ReadAllText(storeManifestPath);
            File.WriteAllText(storeManifestPath, manifest);
            Debug.Log("Repaired store manifest.");
        }

@camogram

Thank you for filing a bug and finding a work-around. I'll ping the dev team so they'll be on the lookout for this issue.

just wondering where id use this

[quote=“BatgirlDee”, post:10, topic: 922284]
just wondering where id use this
[/quote]

The full file (Assets/Editor/MyPostProcessFix.cs) might look like:

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;

namespace MyUnityApp
{
    /// <summary>
    /// Fixes
    /// </summary>
    public class WSAPostProcessor
    {
        /// <summary>
        /// Post processor to fix:
        /// - Bug where StoreManifest.xml has an invalid character, causing store submission to fail ( https://discussions.unity.com/t/922284 )
        /// </summary>
        [PostProcessBuild]
        public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
        {
            if (buildTarget != BuildTarget.WSAPlayer)
            {
                return;
            }

            string storeManifestPath = Path.Combine(path, Application.productName, "StoreManifest.xml");
            string manifest = File.ReadAllText(storeManifestPath);
            File.WriteAllText(storeManifestPath, manifest);
            Debug.Log("Repaired store manifest.");
        }
    }
}

Then you should see when you build a WSAPlayer, “Repaired Store Manifest” in the console.


What's the invalid character? The question mark?

No, the bytes not decoding into ascii properly - in the image, the black "ZWNBSP".

Issue tracker: https://issuetracker.unity3d.com/issues/there-is-an-invalid-character-at-the-start-of-the-storemanifest-dot-xml-when-building-for-uwp


Oh, weird. I didn't get those in my store manifest.

In the Build Settings, I see "The local machine does not support running projects compiled for the arm64 architecture" As a result the solution file is not updated and upgrading Unity version or building to a new folder does not work (i.e., the folder remains empty), too. I am not sure whether the problem is attributable to the manifest file. Any new suggestions?

If a build fails from Unity and it produces an empty project, there must be some other error. That "local machine does not support running projects compiled for the ARM64 architecture" message just means that build & run button won't work, but "build" still will.

All of a sudden I'm receiving the "Package acceptance validation error: StoreManifest.xml is invalid. Data at the root level is invalid. Line 1, position 1." error. Has this been fixed since or a workaround?

[quote]
All of a sudden I'm receiving the "Package acceptance validation error: StoreManifest.xml is invalid. Data at the root level is invalid. Line 1, position 1." error. Has this been fixed since or a workaround?
[/quote]

See https://issuetracker.unity3d.com/issues/there-is-an-invalid-character-at-the-start-of-the-storemanifest-dot-xml-when-building-for-uwp, a bunch of fixed versions have been released.


Thank you. I will download one of the new versions with the fix applied.