Showing ClickOnce deployment version on WPF application

后端 未结 5 985
夕颜
夕颜 2021-02-13 18:00

I\'m deploying now a WPF c# project and want to put the clickonce version (rather than the assembly or product version) on the screen title. I used to do it in

5条回答
  •  一个人的身影
    2021-02-13 18:16

    This solution is similar to @Engin, but uses XPath.

    XmlDocument xmlDoc = new XmlDocument();
    xmlDoc.Load("...");
    XmlNamespaceManager ns = new XmlNamespaceManager(xmlDoc.NameTable);
    ns.AddNamespace("asmv1", "urn:schemas-microsoft-com:asm.v1");
    string xPath = "/asmv1:assembly/asmv1:assemblyIdentity/@version";
    XmlNode node = xmlDoc.SelectSingleNode(xPath, ns);
    string version = node.Value;
    

提交回复
热议问题