3

我正在使用 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!” 应用程序,看看它是否会很好地发布,它确实做到了。

解决办法是什么?

4

5 回答 5

2

检查以下内容:

  • 用户的计算机上是否安装了 .NET 4?

  • 你是如何发布应用程序的,你在使用 Visual Studio 吗?

  • 发布后您是否对部署进行了任何更改?

  • 如果您手动将文件移动到部署位置,结构是否与原始结构相同?

尝试启用详细日志记录,看看是否能提供更多信息。ClickOnce 部署中的增强日志记录一文向您展示了如何做到这一点。

于 2012-07-04T23:48:52.237 回答
1

我得到了同样的错误。在我重命名应用程序属性下第一个选项卡上的程序集名称后,问题得到解决。似乎有一个带有空格的程序集名称会创建一个带有空格的清单文件名,并且似乎会产生问题。我的应用程序集名称被命名为“Capital Manager”。在我将其更改为“Capital_Manager”(我将空格替换为下分“_”)后,问题得到了解决。

于 2013-04-01T00:14:26.390 回答
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 ( CLR 2.0) 编译的 Mage,尝试加载 .NET 4.0 程序集会导致处理的BadImageFormatException异常,并且后备行为是将这些文件视为内容文件。

于 2013-05-28T14:25:12.983 回答
1

您的应用程序文件夹是否有子文件夹?昨天我得到了同样的 HRESULT,根本原因是库 (EntityFramework.dll) 位于顶层和子文件夹中。(有一个关于此的 MAGE 警告,但未将其作为错误处理。)我更新了我的脚本以从子文件夹中删除 EntityFramework.dll,现在 ClickOnce 很好。

于 2016-08-26T16:04:57.013 回答
1

只是另一种可能性 - 在将 dpiAware 添加到新创建的 app.manifest 文件时,我遇到了类似的错误。ClickOnce 立即开始失败。

我在这里遵循了建议:安装 ClickOnce 发布的 DPI 感知应用程序

所以如果你一直在做 dpi 的事情,也许看看那里。

于 2019-12-10T18:17:30.360 回答