清单可能无效或无法打开文件。

时间:2013-04-03 08:53:00

标签: c# .net wpf clickonce

我知道这是一个非常普遍的问题。但是,稍有不同,我的WPF安装完美,可在Windows 7和Windows 8操作系统上运行。但是,当尝试在运行Windows XP的VM上安装时,会出现以下错误:

无法继续。应用程序格式不正确。的详情

平台版本信息

Windows             : 5.1.2600.196608 (Win32NT)
    Common Language Runtime     : 4.0.30319.1
    System.Deployment.dll       : 4.0.30319.1 (RTMRel.030319-0100)
    clr.dll             : 4.0.30319.1 (RTMRel.030319-0100)
    dfdll.dll           : 4.0.30319.1 (RTMRel.030319-0100)
    dfshim.dll          : 4.0.31106.0 (Main.031106-0000)

SOURCES
    Deployment url          : file:///S:/K3FrontEnd_NET4/Karacell3.application

错误摘要

以下是错误摘要,稍后将在日志中列出这些错误的详细信息。

* Activation of S:\K3FrontEnd_NET4\Karacell3.application resulted in exception. Following failure messages were detected:
        + Exception reading manifest from file:///S:/K3FrontEnd_NET4/Karacell3.application: the manifest may not be valid or the file could not be opened.
        + Manifest XML signature is not valid.
        + SignatureDescription could not be created for the signature algorithm supplied.

COMPONENT STORE TRANSACTION FAILURE SUMMARY
    No transaction error was detected.

WARNINGS
    There were no warnings during this operation.

OPERATION PROGRESS STATUS
    * [4/3/2013 2:58:13 PM] : Activation of S:\K3FrontEnd_NET4\Karacell3.application has started.

ERROR DETAILS
    Following errors were detected during this operation.
    * [4/3/2013 2:58:14 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Exception reading manifest from file:///S:/K3FrontEnd_NET4/Karacell3.application: the manifest may not be valid or the file could not be opened.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
            at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
            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)
        --- Inner Exception ---
        System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
        - Manifest XML signature is not valid.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
        --- Inner Exception ---
        System.Security.Cryptography.CryptographicException
        - SignatureDescription could not be created for the signature algorithm supplied.
        - Source: System.Security
        - Stack trace:
            at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key)
            at System.Security.Cryptography.Xml.SignedXml.CheckSignature(AsymmetricAlgorithm key)
            at System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(AsymmetricAlgorithm& signingKey)
            at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags)
            at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)

COMPONENT STORE TRANSACTION DETAILS

没有可用的交易信息。

  • 我使用有效密钥重新签名了该应用程序
  • 我已安装在多台PC上,安装并正常运行。

请帮我列举此错误的可能原因。

9 个答案:

答案 0 :(得分:5)

我能够通过删除清单的签名来解决我的问题。
如果右键单击项目并转到属性,然后转到签名选项卡;取消选中签署ClickOnce清单签署程序集
我不确定这在安全性方面做了什么,但在我删除这些选项后安装了我的应用程序。

答案 1 :(得分:2)

我遇到了同样的问题,只是机器没有合适的.Net版本。

答案 2 :(得分:1)

我找到了原因。这是服务器设置中的MIME类型问题。

因此,请在FTP根目录中添加.htaccess文件。

并将其写在里面。

AddType application/microsoftpatch .msp
AddType application/microsoftupdate .msu 

AddType application/x-ms-application .application  
AddType application/x-ms-application .manifest  
AddType application/octet stream .deploy   

AddType application/x-ms-vsto .vsto

对我来说很完美。

答案 3 :(得分:0)

我之前看到类似的问题,因为缺少加密提供程序,特定的WIndows操作系统无法“理解”或验证证书哈希的结果,在我的特定情况下,它与使用v3生成的X509证书有关clickonce签名的模板。

  

无法为提供的签名算法创建SignatureDescription

消息的突出显示部分与在WinXP计算机上失败之前在多台计算机上成功安装相结合,表明您也遇到类似问题 - WinXP不知道您在证书中指定的加密算法用来签署clickonce。

我不知道这是一个很好的解决方案,你会在互联网上找到的正常建议是使用v2模板生成X509而不是v3模板,但这不一定是一个很好的解决方案,而且超出了大多数组织的能力(特别是大多数人使用购买的证书而不是从他们自己的证书颁发机构生成的证书)。

答案 4 :(得分:0)

您是否在Windows XP计算机上安装了SP-3,以及所有可用的Windows更新? Microsoft会定期针对证书,受信任的发布者和其他相关信息推出代码更新。

答案 5 :(得分:0)

这是因为您的开发者计算机安装了.NET 4.5,而您的客户端计算机只安装了.NET 4.0。 .NET 4.0客户端计算机无法读取清单,因为他们期望SHA-1,而.NET 4.5开发人员计算机可以。

答案 6 :(得分:0)

我有类似的问题,几乎一样。我通过删除不在应用程序文件根目录中的.dll解决了一个问题。

Visual Studio 2019: 右键单击项目名称-属性-发布-应用程序文件。

与本文类似: https://social.msdn.microsoft.com/Forums/en-US/3d0c4382-9b48-4d28-9b79-25607e668074/problem-with-installing-clickonce-after-adding-reportviewercontrol-14-to-the-project?forum=winformssetup

答案 7 :(得分:0)

注释掉 app.manifest 中的 vista 条目对我有用

    <application>
      <!-- A list of all Windows versions that this application is designed to work with. 
      Windows will automatically select the most compatible environment.-->

      <!-- If your application is designed to work with Windows Vista, uncomment the following supportedOS node-->
      <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"></supportedOS>-->

      <!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
      <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>

      <!-- If your application is designed to work with Windows 8, uncomment the following supportedOS node-->
      <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"></supportedOS>

      <!--The ID below indicates application support for Windows 8.1 -->
      <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
      
      <!--The ID below indicates application support for Windows 10 -->
      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>

    </application>

答案 8 :(得分:-1)

对于使用Visual Studio 2012构建并部署在具有所有关键更新(安装了SP3和Windows Installer 4.5)的XP计算机上的WinForms应用程序,我遇到了同样的问题。我也必须通过转到项目的“属性”页面上的[签名]选项卡来将我的应用程序更改为未签名。我取消选中两个: [签署Click One清单]和[签署装配]。在启用了签名的Windows 7计算机上安装了相同的应用程序。