此程序集由比当前加载的运行时更新的运行时构建,无法加载。 <但事实并非如此! [英] This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. < But it's not!

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

问题描述





我已经在我的.NET Framework 4.0解决方案中升级了一个类库项目。但升级后我发现我使用的服务器不支持.NET Framework 4.0。



所以我不得不再次降级到v3.5。但在这样做之后,我再也无法运行我的应用程序了。当我运行它,它正确编译,启动浏览器,然后我收到此错误:



Hi,

I've upgraded a class library project in my solution to .NET Framework 4.0. But after the upgrade I figured out the server i'm using doesn't support .NET Framework 4.0.

So I had to downgrade again to v3.5. But after doing this, I cannot run my application anymore. When I run it, it compiles correctly, starts up the browser and then I get this error:

Could not load file or assembly 'Xxxxx_DLL' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.BadImageFormatException: Could not load file or assembly 'Xxxxx_DLL' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.





使用assambly的web应用程序设置为。 .NET Framework 3.5和assambly本身也设置为.NET Framework 3.5。所以这个错误应该是不可能的。



你们有什么建议吗?



The webapplication using the assambly is set to .NET Framework 3.5 and the assambly itself is also set to .NET Framework 3.5. So this error should not be possible.

Do you guys have any suggestions?

推荐答案

问题很可能是你作为应用程序一部分引用的一个或多个程序集。



在VS中进入你的项目,打开References分支,并记下您正在使用的所有参考。然后,您可以依次突出显示每个项目并查看属性窗格中的运行时版本属性。至少有一个将大于你的应用程序所期望的3.5。
The problem is likely to be in one or more of the assemblies you are referencing as part of your application.

Go into your project in VS, open up the "References" branch, and make a note of all the references you are using. You can then highlight each one in turn and look at the "Runtime Version" property in the Properties pane. At least one will be greater than the 3.5 your app is expecting.


结果更新的DLL(v4)仍然在Bin目录下以不同的名称。忘了我重命名了项目名。
Turns out the updated DLL (v4) was still in the Bin directory under a different name. Forgot I renamed the projectname.


这篇关于此程序集由比当前加载的运行时更新的运行时构建,无法加载。 <但事实并非如此!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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