C# 清单可能无效或无法打开文件。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15782798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Manifest may not be valid or the file could not be opened.
提问by Shambavi
I know it is a very commonly faced problem. But, there is a slight difference, my WPF installs perfectly and runs on Windows 7 and Windows 8 OSes. But, when tried to install on a VM running Windows XP, it gives the following Error:
我知道这是一个非常普遍的问题。但是,有一点不同,我的 WPF 安装完美,可以在 Windows 7 和 Windows 8 操作系统上运行。但是,当尝试在运行 Windows XP 的 VM 上安装时,会出现以下错误:
Cannot continue. The application is improperly formatted. Details:
无法继续。应用程序格式不正确。详情:
PLATFORM VERSION INFO
平台版本信息
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
ERROR SUMMARY
错误总结
Below is a summary of the errors, details of these errors are listed later in the log.
下面是错误的摘要,这些错误的详细信息在日志后面列出。
* 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
组件商店交易详情
No transaction information is available.
没有可用的交易信息。
- I re-signed the application with a valid key
- I have installed on multiple PCs and it installs and works fine.
- 我使用有效密钥重新签署了应用程序
- 我已经安装在多台 PC 上,它安装并运行良好。
Please help me enumerate possible cause of this error.
请帮我列举这个错误的可能原因。
回答by slugster
I have seen a similar issue before where a particular WIndows OS could not 'understand' or validate the results of a certificate hash due to missing crypto providers, in my particular case it was related to using a X509 certificate generated using a v3 template for the clickonce signing.
我之前见过类似的问题,由于缺少加密提供程序,特定的 WINdows 操作系统无法“理解”或验证证书哈希的结果,在我的特定情况下,它与使用使用 v3 模板生成的 X509 证书有关单击一次签名。
SignatureDescription could not be created for the signature algorithm supplied
无法为提供的签名算法创建 SignatureDescription
The highlighted part of the message combined with the successful installation on several machines before failing on the WinXP machine would indicate that you are also running into a similar problem - WinXP doesn't know about the crypto algorithmn specified in the certificate that you've used to sign the clickonce.
消息中突出显示的部分与在 WinXP 机器上失败之前在多台机器上的成功安装相结合,表明您也遇到了类似的问题 - WinXP 不知道您使用的证书中指定的加密算法签署clickonce。
I don't know of a good solution to this, normal advice you will find on the internet is to use a v2 template to generate the X509 instead of a v3 template, but this is not necessarily a good solution and is beyond the capabilities of most organisations (espcecially as most people use a bought certificate rather than certs generated from their own Certificate Authority).
我不知道对此有什么好的解决方案,您会在互联网上找到的一般建议是使用 v2 模板生成 X509 而不是 v3 模板,但这不一定是一个好的解决方案,并且超出了大多数组织(尤其是因为大多数人使用购买的证书而不是从他们自己的证书颁发机构生成的证书)。
回答by RobinDotNet
Do you have SP-3 installed on the windows XP machine, and all of the available Windows Updates? Microsoft pushes out updates to the code around certificates, and the trusted publishers and other related info periodically.
您是否在 Windows XP 机器上安装了 SP-3 以及所有可用的 Windows 更新?Microsoft 会定期推送对证书周围代码、受信任发布者和其他相关信息的更新。
回答by Pedro.The.Kid
I had the same issue and it was just the machine didn't have the appropriate .Net version.
我遇到了同样的问题,只是机器没有合适的 .Net 版本。
回答by Zoey
I was able to solve my issue by removing the signing of the manifest.
If you right-click your project and go to properties then to the Signing Tab; uncheck the Sign the ClickOnce manifestsand Sign the assembly.
I'm not sure what this does in terms of security but my app installed after I removed these options.
我能够通过删除清单的签名来解决我的问题。
如果您右键单击您的项目并转到属性,然后转到签名选项卡;取消选中Sign the ClickOnce manifests和Sign the assembly。
我不确定这在安全方面有什么作用,但在我删除这些选项后安装了我的应用程序。
回答by DevJohn
I had the same issue for a WinForms app that was built with Visual Studio 2012 and deployed on an XP machine with all the critical updates (SP3 installed and Windows Installer 4.5). I too had to change my application to be unsigned by going to the [Signing] tab on the Properties page of my project. I unchecked both: [Sign the Click One manifests] and [Sign the assembly]. The same application installed fine on Windows 7 machines with the signing enabled.
对于使用 Visual Studio 2012 构建并部署在具有所有关键更新(已安装 SP3 和 Windows Installer 4.5)的 XP 计算机上的 WinForms 应用程序,我遇到了同样的问题。我也不得不通过转到我的项目的“属性”页面上的 [签名] 选项卡将我的应用程序更改为未签名。我取消选中:[签署 Click One 清单] 和 [签署程序集]。在启用了签名的 Windows 7 机器上安装了相同的应用程序。
回答by Subha
It's because your developer machine had .NET 4.5 installed, while your client machines only had .NET 4.0 installed. The .NET 4.0 client machines can't read the manifest, as they expect SHA-1, while the .NET 4.5 developer machines can.
这是因为您的开发机器安装了 .NET 4.5,而您的客户端机器只安装了 .NET 4.0。.NET 4.0 客户端机器无法读取清单,因为他们期望 SHA-1,而 .NET 4.5 开发人员机器可以。
回答by Lin
I found the reason. It was MIME type issue in server setting.
我找到了原因。这是服务器设置中的 MIME 类型问题。
So, please add .htaccess
file in FTP root directory.
因此,请.htaccess
在 FTP 根目录中添加文件。
And write this in it.
并在其中写下这个。
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
It works perfectly for me.
它非常适合我。
回答by I.Step
I had similar issue, almost the same. I solved an issue by removing .dll that are not in root of application files.
我有类似的问题,几乎相同。我通过删除不在应用程序文件根目录中的 .dll 解决了一个问题。
Visual studio 2019: Right click on project name - Properties - Publish - Application files.
Visual Studio 2019:右键单击项目名称 - 属性 - 发布 - 应用程序文件。
Like in this article: 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
就像这篇文章: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