private static void UpdateProjectFile()

in Assets/Xbox Live/Editor/XboxLivePostProcessing.cs [87:132]


        private static void UpdateProjectFile(string projectFolder, XboxLiveAppConfiguration configuration)
        {
            var scriptingBackend = PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA);

            // Copy the XboxServices.config file over to the project folder.
            CopyConfigurationFile(XboxLiveAppConfiguration.FileName, projectFolder);

            string projectFile = null;
            if (scriptingBackend == ScriptingImplementation.WinRTDotNET)
            {
                projectFile = Path.Combine(projectFolder, Application.productName + ".csproj");
            }
            else if (scriptingBackend == ScriptingImplementation.IL2CPP)
            {
                projectFile = Path.Combine(projectFolder, Application.productName + ".vcxproj");
            }

            XDocument project = XDocument.Load(projectFile);
            XNamespace msb = "http://schemas.microsoft.com/developer/msbuild/2003";
            XmlNamespaceManager ns = new XmlNamespaceManager(new NameTable());
            ns.AddNamespace("msb", msb.NamespaceName);

            // Add the XboxService.config to the project if it doesn't exist already.
            XElement identityItemGroup = project.XPathSelectElement("msb:Project/msb:ItemGroup[msb:AppxManifest]", ns);

            if (scriptingBackend == ScriptingImplementation.WinRTDotNET)
            {
                if (identityItemGroup.XPathSelectElement("msb:Content[@Include='XboxServices.config']", ns) == null)
                {
                    identityItemGroup.Add(new XElement(msb + "Content",
                        new XAttribute("Include", "XboxServices.config"),
                        new XElement(msb + "CopyToOutputDirectory", "PreserveNewest")));
                }
            }
            else if (scriptingBackend == ScriptingImplementation.IL2CPP)
            {
                if (identityItemGroup.XPathSelectElement("msb:None[@Include='XboxServices.config']", ns) == null)
                {
                    identityItemGroup.Add(new XElement(msb + "None",
                        new XAttribute("Include", "XboxServices.config"),
                        new XElement(msb + "DeploymentContent", "true")));
                }
            }

            project.Save(projectFile);
        }