如何将支持的OS添加到Windows单击一次应用程序清单?

时间:2015-08-26 22:38:58

标签: .net clickonce manifest

我正在尝试将一个supportedOS标记添加到应用程序清单的单击中。对常规应用程序执行此操作的常用方法是将app.manifest文件添加到包含supportedOS标记的项目中,如下所示。我删除了自动生成的点击清单中已包含的所有内容。通常单击一次应用程序不需要app.manifest,因为在发布步骤中会自动生成一个app.manifest。

<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
    <application>
      <!-- Windows 7 -->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
    </application>
  </compatibility>
</assembly>

要向应用程序添加一个最小的app.manifest,我觉得这是一个正确的方法,可以将supportedOS标记添加到标准单击清单一次。当我发布应用程序时,app.manifest内容会合并到生成的单击一次应用程序清单中。它对我来说很好。

但是,当我尝试安装Click once应用程序时遇到以下错误,我无法安装。

* [8/26/2015 3:30:38 PM] : Processing of deployment manifest has successfully completed.
    * [8/26/2015 3:30:38 PM] : Installation of the application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [8/26/2015 3:30:38 PM] System.InvalidOperationException
        - The 'EndValidation' method cannot not be called when all the elements have not been validated. 'ValidateEndElement' calls corresponding to 'ValidateElement' calls might be missing.
        - Source: System.Xml
        - Stack trace:
            at System.Xml.Schema.XmlSchemaValidator.EndValidation()
            at System.Xml.XsdValidatingReader.Read()
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

要重新创建:您应该能够通过创建一个没有编辑的全新WPF应用程序来重新创建此错误。使用发布向导在项目属性页的“发布”选项卡上添加所需的发布信息。您现在应该能够成功发布和安装。

更新:删除“签署单击一次清单”选项,以便发生EndValidation错误

如果您签署清单,则似乎不会发生此错误。发生在我身上的是它适用于一个支持的OS标签,它适用于两个,但当我尝试添加第三个supportedOS标签时,我遇到了由Blue发布的this问题。

+ Exception reading manifest from <APPPATH>.exe.manifest: the manifest may not be valid or the file could not be opened.
+ The element 'assembly' in namespace 'urn:schemas-microsoft-com:asm.v1' has invalid child element 'SignedInfo' in namespace 'http://www.w3.org/2000/09/xmldsig#'. 
List of possible elements expected: 'dependency' in namespace 'urn:schemas-microsoft-com:asm.v1' 

问题:任何人都可以向我提出有关将ClickOS信息添加到Click Once应用程序的正确方法的建议吗?

1 个答案:

答案 0 :(得分:0)

请参阅How do you add a supported OS to a ClickOnce manifest?,特别是Alexy Kozlov的最后一个答案,关于从兼容性列表中删除Vista guid。