错误1001.无法加载文件或程序集。 ...由比当前加载的运行时更新的程序集构建... [英] Error 1001. Could not load file or assembly. ...built by an assembly newer than the currently loaded runtime...

查看:305
本文介绍了错误1001.无法加载文件或程序集。 ...由比当前加载的运行时更新的程序集构建...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的Deployers我在VS2010和.NET 4.0下有一个C#托管代码应用程序,它有一个构建两个.msi的部署解决方案,第一个用于基础应用程序的Tempest.Deployment.msi,以及第二个Tempest.DeploymentXXX.msi它没有中心.exe
但只是安装了一些额外的文件目录。


所有内容都是为Release / AnyCpu / NET4.0配置的。 并且构建和安装都在Windows 7 Enterprise 64位下运行。


两个.msi都加载了一个名为CustomActions.dll的自定义操作库,它设置了一些环境变量和一个注册表项。 两个.msi的 构建没有错误。 当涉及到安装时,Tempest.Deployment.msi - 携带基础
应用程序 - 毫无困难地加载CustomActions.dll。 但是当运行Tempest.DeploymentXXX.msi时,我收到以下错误:


   错误1001.初始化安装时发生异常:

    System.BadImageFormatException:无法加载文件或程序集'file:/// C:\Program


    Files \DRS-AMTC \Tempest \TempestCustomActions.dll'或其依赖项之一。这是


   程序集由比当前加载的运行时更新的运行时构建,不能是


   这是一个难题,因为第一个.msi加载.dll没有问题,并且因为该过程中涉及的所有内容都是.NET 4.0和64位计算机。


任何想法?


(有没有可能原因与两个.msi之间唯一明显的明显区别有关,即第二个安装没有申请.exe但只是一组文件?)


 


Peter Schwenn


 


schwenn

解决方案

与.NET 3.5及以前版本的.NET不同,.NET 4.0是一个新的.NET核心。其他程序集构建目标.NET 3.5或更低版本使用2.0核心。当您在VS 2010中构建应用程序并将其定位到.NET 4.0时,应检查每个程序集以确保它们的
也是在4.0下构建的。


 


您需要检查的程序集是 TempestCustomActions.dll及其依赖性。这样做的方法是使用.NET Reflector加载该DLL( http://www.red-gate的.com /产品/ dotnet的开发/反射/ )。
反射器节目中有一个字段“ Target Runtime”选择装配时。 


Dear DeployersI have a C# managed code application under VS2010 and NET 4.0 that has a deployment Solution that builds two .msi's, the first Tempest.Deployment.msi for the base application, and the second Tempest.DeploymentXXX.msi that has no central .exe but simply installs some extra file directories.

Everything is configured for Release/AnyCpu/NET4.0.  And both builds and installs are run under Windows 7 Enterprise 64-bit.

Both .msi's load a Custom Action library called CustomActions.dll which sets some Environment variables and a registry entry.  Both .msi's  build without error.  And when it comes to the install, Tempest.Deployment.msi -- carrying the base application -- loads CustomActions.dll without difficulty.  But when Tempest.DeploymentXXX.msi is run, I get the following error:

    Error 1001. Exception occurred while initializing the installation:
    System.BadImageFormatException: Could not load file or assembly 'file:///C:\Program
    Files\DRS-AMTC\Tempest\TempestCustomActions.dll' or one of its dependencies. This
    assembly is built by a runtime newer than the currently loaded runtime and cannot be
    loaded.

This is a puzzle since the first .msi has no trouble loading that .dll, and because everything involved in the process are NET 4.0 and 64-bit machines.

Any ideas?

(Is there any chance that the cause is related to the only significant apparent difference between the two .msi's, namely that the second one installs no application .exe but simply a group of files?)

 

Peter Schwenn

 


schwenn

解决方案

Unlike .NET 3.5 and previous version of .NET, .NET 4.0 is a new .NET core. Other assembly built target to .NET 3.5 or lower version uses 2.0 core. When you build your app in VS 2010 and target to .NET 4.0, you should check each assembly to make sure they are also built under 4.0.

 

The assembly you need to check is TempestCustomActions.dll and its dependence. The way to do it is load that dll with .NET Reflector (http://www.red-gate.com/products/dotnet-development/reflector/). There is one field in reflector shows “Target Runtime” when the assembly is selected. 


这篇关于错误1001.无法加载文件或程序集。 ...由比当前加载的运行时更新的程序集构建...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆