我正在尝试将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 内容将合并到生成的单击一次应用程序清单中。我觉得还可以。
但是,当我尝试安装“单击一次”应用程序时,遇到以下错误并且无法安装。
* [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 应用程序来重新创建此错误。使用项目属性页面上的发布选项卡上的发布向导添加所需的发布信息。您现在应该能够成功发布和安装。
Update:删除“对单击一次清单进行签名”选项以防止发生 EndValidation 错误
If you do sign明显这个错误似乎没有发生。相反,我遇到的情况是,它适用于一个supportedOS标签,它适用于两个supportedOS标签,但是当我尝试添加第三个supportedOS标签时,我遇到了this https://stackoverflow.com/questions/27106385/clickonce-manifest-has-invalid-children-but-xml-matches-old-published-manifestBlue 发布的问题。
+ 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'
问题:任何人都可以建议我将支持的操作系统信息添加到 Click Once 应用程序的正确方法吗?