我正在使用Visual Studio 2010和VB.NET。我的目标环境是.NET Framework 4.0。
因此,当我使用提供的Setup.exe
文件发布项目时,我遇到了这个问题。弹出验证应用程序要求后,会弹出一个警告文本:
无法继续。应用程序格式不正确。请联系应用程序供应商以获取帮助。
当我点击“详情”按钮时,它显示了这个错误:
PLATFORM VERSION INFO
Windows : 6.1.7601.65536 (Win32NT)
Common Language Runtime : 4.0.30319.239
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll : 4.0.30319.239 (RTMGDR.030319-2300)
dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll : 4.0.31106.0 (Main.031106-0000)
SOURCES
Deployment URL : file:///I:/ProjectBMTRelease/ProjectBMT.application
IDENTITIES
Deployment Identity : ProjectBMT.application, Version=1.0.0.6, Culture=neutral, PublicKeyToken=7439f62500c0364d, processorArchitecture=x86
APPLICATION SUMMARY
* Installable application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of I:\ProjectBMTRelease\ProjectBMT.application resulted in exception. Following failure messages were detected:
+ Exception reading manifest from file:///I:/ProjectBMTRelease/Application%20Files/ProjectBMT_1_0_0_6/ProjectBMT.exe.manifest: the manifest may not be valid or the file could not be opened.
+ Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed:
-HRESULT: 0x80070c81
Start line: 0
Start column: 0
Host file:
+ Exception from HRESULT: 0x80070C81
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [6/23/2012 5:21:36 PM] : Activation of I:\ProjectBMTRelease\ProjectBMT.application has started.
* [6/23/2012 5:21:36 PM] : Processing of deployment manifest has successfully completed.
* [6/23/2012 5:21:36 PM] : Installation of the application has started.
ERROR DETAILS
Following errors were detected during this operation.
* [6/23/2012 5:21:36 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from file:///I:/ProjectBMTRelease/Application%20Files/ProjectBMT_1_0_0_6/ProjectBMT.exe.manifest: 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.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)
--- Inner Exception ---
System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed:
-HRESULT: 0x80070c81
Start line: 0
Start column: 0
Host file:
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.LoadCMSFromStream(Stream stream)
at System.Deployment.Application.Manifest.AssemblyManifest..ctor(FileStream fileStream)
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
--- Inner Exception ---
System.Runtime.InteropServices.COMException
- Exception from HRESULT: 0x80070C81
- Source: System.Deployment
- Stack trace:
at System.Deployment.Internal.Isolation.IsolationInterop.CreateCMSFromXml(Byte[] buffer, UInt32 bufferSize, IManifestParseErrorCallback Callback, Guid& riid)
at System.Deployment.Application.Manifest.AssemblyManifest.LoadCMSFromStream(Stream stream)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
我检查了我的项目的清单文件,但我不够好找到任何问题。有关其他信息,我创建了简单的“Hello World!”应用程序,看它是否会很好地发布,它确实发布了。
解决方案是什么?
答案 0 :(得分:2)
检查以下内容:
用户是否在其计算机上安装了.NET 4?
您是如何发布应用程序的,您使用的是Visual Studio吗?
发布后是否对部署进行了任何更改?
如果您手动将文件移动到部署位置,结构是否与原始结构相同?
尝试启用详细日志记录,看看是否提供了更多信息。该 文章 Enhanced Logging in ClickOnce Deployment 向您展示了如何做到这一点。
答案 1 :(得分:1)
我得到了同样的错误。重命名我在应用程序属性下的第一个选项卡上找到的程序集名称后问题得到解决。看起来像一个带空格的程序集名称会创建一个带有空格的清单文件名,这似乎会产生问题。我的应用程序程序集名称被命名为“Capital Manager”。在我将其更改为“Capital_Manager”(我用低于分数“_”替换空格)后,问题得到了解决。
答案 2 :(得分:1)
我在尝试运行ClickOnce安装程序时收到了错误报告和调用堆栈,与您的错误相同。到目前为止我的发现可能对到达这里的其他人有所帮助,所以我会发布详细信息,但我有一种感觉,同样的错误报告可能是由一系列不同的问题引起的。
我注意到的第一件事是我的应用程序清单(列出应用程序的所有文件的清单或每个文件的签名哈希)都有具有无效publicKeyToken的程序集的条目,例如,
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1">
<asmv1:assemblyIdentity name="foo.exe" version="1.2.3.4" publicKeyToken="0000000000000000" language="neutral" processorArchitecture="msil" type="win32" />
在文件的下方,而不是查看程序集的 dependentAssembly 元素,某些程序集被列为普通内容文件(文件元素)。
这些问题肯定会使ClickOnce部署无效,原因是使用的Mage版本是针对较早版本的.NET编译的,而不是它尝试创建清单的程序集。在创建应用程序清单时,Mage将尝试按如下方式读取程序集:
AssemblyIdentity.FromFile(fileName);
对于针对.NET 3.5编译的Mage(CLR 2.0),尝试加载.NET 4.0程序集导致处理BadImageFormatException异常,并且后退行为是对待这些文件作为内容文件。
答案 3 :(得分:1)
您的应用程序文件夹是否包含子文件夹?昨天我得到了同样的HRESULT,根本原因是一个库(EntityFramework.dll)同时位于顶层和子文件夹中。 (有关于此的MAGE警告,但它没有作为错误处理。)我更新了我的脚本以从子文件夹中删除EntityFramework.dll,现在ClickOnce很好。
答案 4 :(得分:0)
另一种可能性-将dpiAware添加到新创建的app.manifest文件时,出现类似错误。 ClickOnce立即开始失败。
我在这里遵循了建议:Installing ClickOnce published DPI-aware application
因此,如果您一直在做dpi的事情,也许看看那里。