wpf ClickOnce 安装生成错误:System.Runtime.InteropServices.COMException,无法加载运行时,来自 HRESULT 的异常:0x80131700

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15233477/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 07:54:02  来源:igfitidea点击:

ClickOnce installation generates error: System.Runtime.InteropServices.COMException, Failed to load the runtime, Exception from HRESULT: 0x80131700

.netwpfclickoncefailed-installationcomexception

提问by Felpudo

This error occurs trying to deploy a WPFproject through ClickOnce:

尝试通过 ClickOnce部署WPF项目时发生此错误:

Activation of [...file path...].application resulted in exception. Following failure messages were detected: Failed to load the runtime. (Exception from HRESULT: 0x80131700)

激活 [...file path...].application 导致异常。检测到以下失败消息:无法加载运行时。(来自 HRESULT 的异常:0x80131700)

and

System.Runtime.InteropServices.COMException -Failed to load the runtime. (Exception from HRESULT: 0x80131700) - Source: System.Deployment.

System.Runtime.InteropServices.COMException - 无法加载运行时。(来自 HRESULT 的异常:0x80131700) - 来源:System.Deployment。

Until recently, the project targeted the 32 bit .NET Framework 4 Client Profile, and installed smoothly on all machines. Then we had to switch to .NET Framework 4 full profile because we began including Crystal Reports, which won't do with just the client profile.

直到最近,该项目针对 32 位 .NET Framework 4 Client Profile,并顺利安装在所有机器上。然后我们不得不切换到 .NET Framework 4 完整配置文件,因为我们开始包括Crystal Reports,这不仅仅与客户端配置文件有关。

The .NET Framework 4 full profile installer that we began applying on client machines targets both 32 and 64 bits operating systems. However, the WPF project is compiled specifically for 32 bits, for some reason I currently do not recall. The machines where the application is deployed run Windows 7 64-bit Enterprise with service pack 1. To deploy the new version targeting .NET Framework full profile, we first installed Crystal Reports in the client machines and also installed .NET Framework 4 full profile for those machines that only had the client profile, and then updated the ClickOnce installer for users to download the new application.

我们开始在客户端计算机上应用的 .NET Framework 4 完整配置文件安装程序针对 32 位和 64 位操作系统。但是,WPF 项目是专门为 32 位编译的,出于某种原因,我目前不记得了。部署应用程序的机器运行带有 Service Pack 1 的 Windows 7 64 位企业版。为了部署针对 .NET Framework 完整配置文件的新版本,我们首先在客户端机器中安装了 Crystal Reports,并为那些只有客户端配置文件的计算机,然后更新了 ClickOnce 安装程序以供用户下载新应用程序。

The first thing to highlight is that the ClickOnceupdate of the WPF application went smoothly for some machines, whereas for others it breaks right after downloading the installation files and before installing. We haven't been able to identify what it is that makes the difference.

首先要强调的是,WPF 应用程序的ClickOnce更新在某些机器上进行得很顺利,而对于其他机器,它在下载安装文件之后和安装之前立即中断。我们一直无法确定是什么造成了差异。

Regarding exception 0x80131700, there are several forum publications and blogs that mention installing .NET Framework 3.5 service pack 1. Apparently, however, both machines where the installation breaks and those where it updates fine have it installed. Additionally, we haven't been able to get a .NET Framework version 3.5 with SP1 installer that works: the bootstrapper just hangs, while the full package throws an “File is corrupt” exception while unzipping installation files! It is also worth noting that the WPF application also requires the Microsoft .NET Framework 4 Platform Update 1 - Runtime Update (KB2478063), but that's been the case since the first release, several months ago and we did not have a problem with that one before.

关于异常 0x80131700,有几个论坛出版物和博客提到安装 .NET Framework 3.5 Service Pack 1。然而,显然,安装中断的机器和更新正常的机器都安装了它。此外,我们还无法获得带有 SP1 安装程序的 .NET Framework 3.5 版:引导程序只是挂起,而整个包在解压缩安装文件时抛出“文件已损坏”异常!还值得注意的是,WPF 应用程序还需要 Microsoft .NET Framework 4 平台更新 1 - 运行时更新 (KB2478063),但自几个月前第一次发布以来就是这种情况,我们没有遇到任何问题前。

We have gone through many forum and blog posts regarding the “System.Runtime.InteropServices.COMException” exception, as well as the “Failed to load the runtime (Exception from HRESULT: 0x80131700)” one. But so far, we haven't been able to pinpoint what is it that lets the latest version of our application install perfectly in some machines, while we get the aforementioned behavior in others, in an environment where apparently all machines, being part of a corporate network, share pretty much the same configuration.

我们浏览了许多关于“System.Runtime.InteropServices.COMException”异常以及“无法加载运行时(来自 HRESULT 的异常:0x80131700)”异常的论坛和博客文章。但到目前为止,我们还无法确定是什么让我们的应用程序的最新版本在某些机器上完美安装,而我们在其他机器上获得了上述行为,在一个显然所有机器都参与其中的环境中企业网络,共享几乎相同的配置。

And we haven't been able to solve the problem either.

而且我们也无法解决问题。

I will now post the full error log generated while trying to install our WPF application in those machines where it won't work (it's in Spanish, sorry):

我现在将发布在那些无法运行的机器上尝试安装我们的 WPF 应用程序时生成的完整错误日志(它是西班牙语,抱歉):

INFORMACIóN DE VERSIóN DE LA PLATAFORMA
  Windows                : 6.1.7601.65536 (Win32NT)
  Common Language Runtime: 4.0.30319.296
  System.Deployment.dll  : 4.0.30319.1 (RTMRel.030319-0100)
  clr.dll                : 4.0.30319.296 (RTMGDR.030319-2900)
  dfdll.dll              : 4.0.30319.1 (RTMRel.030319-0100)
  dfshim.dll             : 4.0.31106.0 (Main.031106-0000)

ORíGENES
  Dirección URL de la implementación: file:///C:/Users/cacortes/Desktop/IntegraSF.appref-ms%7C
  Dirección URL del proveedor de la implementación:
    file://consarteam/IntegraSF_Produccion/IntegraSF_Aplicaci%C3%B3nCliente.application
  Dirección URL de la aplicación:
    file://consarteam/IntegraSF_Produccion/Application%20Files/IntegraSF_Aplicaci%C3%B3nCliente_1_0_0_34/IntegraSF_Aplicaci%C3%B3nCliente.exe.manifest

IDENTIDADES
  Identidad de la aplicación: IntegraSF_AplicaciónCliente.exe, Version=1.0.0.34, Culture=neutral,
    PublicKeyToken=4e797c2fd9dcb050, processorArchitecture=x86, type=win32

RESUMEN DEL ERROR
  Abajo se muestra un resumen de los errores; los detalles de estos errores se incluyen en el registro.
  * La activación de C:\Users\cacortes\Desktop\IntegraSF.appref-ms| dio como resultado una excepción. Se detectaron los siguientes mensajes de error:
      + Error al cargar el tiempo de ejecución. (Excepción de HRESULT: 0x80131700)

RESUMEN DE ERRORES DE TRANSACCIóN DEL ALMACéN DE COMPONENTES
  No se detectó ningún error de transacción.

ADVERTENCIAS
  No se generó ninguna advertencia durante esta operación.

ESTADO DE PROGRESO DE LA OPERACIóN
  * [04/03/2013 02:04:57 p.m.]: Se ha iniciado la activación de C:\Users\cacortes\Desktop\IntegraSF.appref-ms|.
  * [04/03/2013 02:04:57 p.m.]: Realizando la comprobación de actualización necesaria según las especificaciones de la implementación.
  * [04/03/2013 02:04:57 p.m.]: Consumiendo nueva actualización.
  * [04/03/2013 02:05:00 p.m.]: Se ha iniciado la instalación de la aplicación.
  * [04/03/2013 02:05:00 p.m.]: Ha finalizado correctamente el procesamiento del manifiesto de la aplicación.
  * [04/03/2013 02:05:00 p.m.]: Se ha encontrado una versión del motor en tiempo de ejecución compatible 4.0.30319.
  * [04/03/2013 02:05:00 p.m.]: Detectando ensamblado independiente CrystalDecisions.ReportAppServer.CommonObjectModel,
Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
  processorArchitecture=msil utilizando
  CrystalDecisions.ReportAppServer.CommonObjectModel,
  Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304,
  processorArchitecture=msil.

* [04/03/2013 02:05:00 p.m.] : Detectando ensamblado independiente stdole, Version=7.0.3300.0, Culture=neutral,
    PublicKeyToken=B03F5F7F11D50A3A utilizando stdole, Version=7.0.3300.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

* [04/03/2013 02:05:00 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.DataDefModel,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:00 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.ObjectFactory,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.ObjectFactory, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:00 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.ReportDefModel,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.ReportDefModel, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:00 p.m.] : Detectando ensamblado independiente CrystalDecisions.Shared, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando CrystalDecisions.Shared,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.CubeDefModel,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.CubeDefModel, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente SAPBusinessObjects.WPF.ViewerShared,
    Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    SAPBusinessObjects.WPF.ViewerShared, Version=13.0.3500.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.CommLayer,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.ClientDoc,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente FlashControlV71, Version=1.0.3187.32366,
    Culture=neutral, PublicKeyToken=692FBEA5521E1304 utilizando
    FlashControlV71, Version=1.0.3187.32366, Culture=neutral,
    PublicKeyToken=692fbea5521e1304.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente SAPBusinessObjects.WPF.Viewer, Version=13.0.3500.0,
    Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando SAPBusinessObjects.WPF.Viewer,
    Version=13.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.Prompting,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.Prompting, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.XmlSerialize,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.XmlSerialize, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.CommonControls,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.CommonControls, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente log4net, Version=1.2.10.0, Culture=neutral,
    PublicKeyToken=692FBEA5521E1304, processorArchitecture=x86 utilizando
    log4net, Version=1.2.10.0, Culture=neutral,
    PublicKeyToken=692fbea5521e1304, processorArchitecture=x86.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportSource, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando CrystalDecisions.ReportSource,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.Controllers,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.ReportAppServer.DataSetConversion,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.ReportAppServer.DataSetConversion,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:01 p.m.] : Detectando ensamblado independiente CrystalDecisions.CrystalReports.Engine,
    Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304,
    processorArchitecture=msil utilizando
    CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0,
    Culture=neutral, PublicKeyToken=692fbea5521e1304,
    processorArchitecture=msil.

* [04/03/2013 02:05:02 p.m.] : Detectando ensamblado independiente ShockwaveFlashObjects, Version=1.0.0.0, Culture=neutral,
    PublicKeyToken=692FBEA5521E1304 utilizando ShockwaveFlashObjects,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=692fbea5521e1304.

                * [04/03/2013 02:05:02 p.m.] : Ha finalizado la solicitud de confianza y detección de plataforma.
                * [04/03/2013 02:05:05 p.m.] : Finalizó la descarga de las dependencias de la suscripción.
                * [04/03/2013 02:05:05 p.m.] : Se ha iniciado la confirmación de la aplicación descargada.

DETALLES DEL ERROR
  Se detectaron los siguientes errores durante esta operación.
  * [04/03/2013 02:05:06 p.m.] System.Runtime.InteropServices.COMException
                 - Error al cargar el tiempo de ejecución. (Excepción de HRESULT: 0x80131700)
                 - Origen: System.Deployment
                 - Seguimiento de la pila:
       en System.Deployment.Application.NativeMethods.GetRequestedRuntimeInfo(String
         pExe, String pwszVersion, String pConfigurationFile, UInt32
         startupFlags, UInt32 runtimeInfoFlags, StringBuilder pDirectory,
         UInt32 dwDirectory, UInt32& dwDirectoryLength, StringBuilder pVersion,
         UInt32 cchBuffer, UInt32& dwLength)

en System.Deployment.Application.Win32InterOp.SystemUtils.CheckSupportedImageAndCLRVersions(String path)
en System.Deployment.Application.SubscriptionStore.CheckApplicationPayload(CommitApplicationParams commitParams)
en System.Deployment.Application.SubscriptionStore.CommitApplication(SubscriptionState&subState, CommitApplicationParams commitParams)
en System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState&subState, ActivationDescription actDesc)
en System.Deployment.Application.ApplicationActivator.ConsumeUpdatedDeployment(SubscriptionState&subState, ActivationDescription actDesc)
en System.Deployment.Application.ApplicationActivator.PerformDeploymentUpdate(SubscriptionState&subState, String& errorPageUrl)
en System.Deployment.Application.ApplicationActivator.ProcessOrFollowShortcut(String shortcutFile, String& errorPageUrl, TempFile& deployFile)
en System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(UriactivationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
en System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

DETALLES DE TRANSACCIóN DEL ALMACéN DE COMPONENTES
  No hay información disponible sobre la transacción.

采纳答案by Felpudo

We have resolved this issue in a manner which suffices our needs in the timeframe we had. For anyone interested in finding out what we did: After installing Crystal Reports runtime for .NET 32 bit, we ended up uninstalling .NET 4 frameworks: both client and full profile; reinstalling them in that same order, and then reinstalling KB2478063. We also installed applicable recommended updates from Microsoft after reinstalling .NET framework. That did the trick for us. However, I also received this response from a Microsoft MVP, which I share with you: link.

我们已经以一种在我们所拥有的时间范围内满足我们需求的方式解决了这个问题。对于任何有兴趣了解我们所做工作的人:在为 .NET 32 位安装 Crystal Reports 运行时后,我们最终卸载了 .NET 4 框架:客户端和完整配置文件;以相同的顺序重新安装它们,然后重新安装 KB2478063。在重新安装 .NET 框架后,我们还安装了来自 Microsoft 的适用推荐更新。这对我们有用。但是,我也收到了来自 Microsoft MVP 的回复,与您分享:链接