Unity-Technologies/UnityCsReference · error · Exception

Invalid platform manifest at \"{0}\".

Error message

Invalid platform manifest at \"{0}\".

What it means

Thrown from GetPlatform when parsing Platforms/UAP/<version>/Platform.xml. The <ApplicationPlatform> element's name attribute must equal "UAP"; a mismatched platform manifest is rejected before API contract references are gathered.

Source

Thrown at Editor/Mono/Scripting/Compilers/UWPReferences.cs:299

                        return true;
                    }
                }
            }

            version = null;
            return false;
        }

        private static string[] GetPlatform(string folder, string version)
        {
            var platformXml = CombinePaths(folder, @"Platforms\UAP", version, "Platform.xml");
            if (!File.Exists(platformXml))
                return Array.Empty<string>();

            var document = XDocument.Load(platformXml);
            var applicationPlatformElement = document.Element("ApplicationPlatform");
            if (applicationPlatformElement.Attribute("name").Value != "UAP")
                throw new Exception(string.Format("Invalid platform manifest at \"{0}\".", platformXml));
            var containedApiContractsElement = applicationPlatformElement.Element("ContainedApiContracts");
            return GetReferences(folder, version, containedApiContractsElement);
        }

        private static string CombinePaths(params string[] paths)
        {
            return Path.Combine(paths);
        }

        private static IEnumerable<UWPExtensionSDK> GetExtensionSDKs(string sdkFolder, string sdkVersion)
        {
            var extensions = new List<UWPExtensionSDK>();
            var extensionsFolder = Path.Combine(sdkFolder, "Extension SDKs");

            if (!Directory.Exists(extensionsFolder))
                return Array.Empty<UWPExtensionSDK>();

            foreach (var extensionFolder in Directory.GetDirectories(extensionsFolder))

View on GitHub (pinned to 225b0fbdb5)

Solutions

  1. Reinstall/repair the Windows SDK so Platforms/UAP/<version>/Platform.xml is a genuine UAP platform manifest.
  2. Confirm the folder and version passed to GetPlatform correspond to an installed UAP SDK.
  3. Open the Platform.xml path from the error and verify <ApplicationPlatform name="UAP">.
Defensive patterns

Strategy: validation

Validate before calling

var doc = XDocument.Load(platformXml);
var platform = doc.Element("ApplicationPlatform");
if (platform?.Attribute("name")?.Value != "UAP")
    throw new InvalidOperationException($"{platformXml} is not a UAP platform manifest.");

Try / catch

try
{
    var refs = GetPlatform(folder, version);
}
catch (Exception ex) when (ex.Message.Contains("Invalid platform manifest"))
{
    // Reinstall/repair the Windows SDK so Platform.xml is a genuine UAP manifest.
}

Prevention

When it happens

Trigger: Calling GetPlatform with a folder/version whose Platform.xml has <ApplicationPlatform name="..."> != "UAP", or where the file exists but describes a different platform, during UWP reference resolution.

Common situations: Wrong Windows SDK installation path, mismatched UAP version folder, corrupted or partial SDK install, or an environment where Platform.xml was replaced by a non-UAP file.

Related errors


AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13). Data as JSON: /api/errors/57b277651307689f. Report an issue: GitHub.