简体   繁体   中英

Reference Component could not be found

i'm trying to develop an application but then these warnings popped out. I have tried disabling my anti-virus (Avira) but it still won't work.

Warning 1   Resolved file has a bad image, no metadata, or is otherwise inaccessible. Could not load file or assembly 'MyAssembly.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.    ConsoleApplication1

Warning 2   The referenced component 'MyAssembly' could not be found. 

Can anybody please help me? Thanks!

What .NET runtime version is your application being developed with?

If the error is to be trusted, your project is say a .NET 3.5 (2.0 runtime) project but the MyAssembly library is developed in .NET 4.0 resulting in the error you see.

You cannot reference newer runtime version assemblies in an older runtime version project. You'd have to "upgrade" your project to at least match the framework version of the assembly given to you.

Right click on your project file and choose properties. Depending on what version of Visual Studio you are using this screen may look different, but go to the application tab and see what the target framework is.

项目属性

Then go to the assembly you referenced in your references and check the "Runtime Version" in the properties section:

参考

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM