Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

Discussion in 'Windows' started by DarkFact, Jul 2, 2023.

  1. DarkFact

    DarkFact

    Joined:
    Dec 27, 2013
    Posts:
    9
    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:/
     
  2. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    395
    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:
    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.
     
  3. DarkFact

    DarkFact

    Joined:
    Dec 27, 2013
    Posts:
    9
    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!
     
  4. DarkFact

    DarkFact

    Joined:
    Dec 27, 2013
    Posts:
    9
    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.
     
  5. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    395
    Sorry building to a new folder didn't fix it; I'm also at a loss regarding this issue.

    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.
     
  6. camogram

    camogram

    Joined:
    Jul 11, 2018
    Posts:
    23
    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:
    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.
     
    Last edited: Jul 11, 2023
  7. camogram

    camogram

    Joined:
    Jul 11, 2018
    Posts:
    23
    This occurs from a blank Unity project in 2022.3.4f1. I have submitted an issue report, IN-47242.
     
  8. camogram

    camogram

    Joined:
    Jul 11, 2018
    Posts:
    23
    Temporary workaround (the invalid char is dropped in File.ReadAllText):

    Code (CSharp):
    1.         [PostProcessBuild]
    2.         public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    3.         {
    4.             if (buildTarget != BuildTarget.WSAPlayer)
    5.             {
    6.                 return;
    7.             }
    8.  
    9.             string storeManifestPath = Path.Combine(path, Application.productName, "StoreManifest.xml");
    10.             string manifest = File.ReadAllText(storeManifestPath);
    11.             File.WriteAllText(storeManifestPath, manifest);
    12.             Debug.Log("Repaired store manifest.");
    13.         }
     
  9. timke

    timke

    Unity Technologies

    Joined:
    Nov 30, 2017
    Posts:
    395
    @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.
     
  10. BatgirlDee

    BatgirlDee

    Joined:
    Mar 20, 2019
    Posts:
    36

    just wondering where id use this
     
  11. camogram

    camogram

    Joined:
    Jul 11, 2018
    Posts:
    23
    The full file (Assets/Editor/MyPostProcessFix.cs) might look like:
    Code (CSharp):
    1. using System.IO;
    2. using UnityEditor;
    3. using UnityEditor.Callbacks;
    4. using UnityEngine;
    5.  
    6. namespace MyUnityApp
    7. {
    8.     /// <summary>
    9.     /// Fixes
    10.     /// </summary>
    11.     public class WSAPostProcessor
    12.     {
    13.         /// <summary>
    14.         /// Post processor to fix:
    15.         /// - Bug where StoreManifest.xml has an invalid character, causing store submission to fail (https://forum.unity.com/threads/build-to-uwp-on-windows-11-with-visual-studio-2022-fails-not-matter-what-settings-are-used.1455835/)
    16.         /// </summary>
    17.         [PostProcessBuild]
    18.         public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
    19.         {
    20.             if (buildTarget != BuildTarget.WSAPlayer)
    21.             {
    22.                 return;
    23.             }
    24.  
    25.             string storeManifestPath = Path.Combine(path, Application.productName, "StoreManifest.xml");
    26.             string manifest = File.ReadAllText(storeManifestPath);
    27.             File.WriteAllText(storeManifestPath, manifest);
    28.             Debug.Log("Repaired store manifest.");
    29.         }
    30.     }
    31. }
    32.  
    Then you should see when you build a WSAPlayer, "Repaired Store Manifest" in the console.
     
  12. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    724
    What's the invalid character? The question mark?
     
  13. camogram

    camogram

    Joined:
    Jul 11, 2018
    Posts:
    23
  14. Mashimaro7

    Mashimaro7

    Joined:
    Apr 10, 2020
    Posts:
    724
  15. KenanBektas

    KenanBektas

    Joined:
    Feb 12, 2021
    Posts:
    1
    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?
     
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,524
    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.
     
  17. Deleted User

    Deleted User

    Guest

    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?
     
  18. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,524
  19. Deleted User

    Deleted User

    Guest