简体   繁体   中英

Is there any way to load an assembly compiled in VS2010 in VS2005?

We have a function in a VS2005 project that loads assembles and get type information from them . It does not instantiate these types though. We tried to load some assembles that are compiled in 2010, but keep getting the following exception.

"Could not load file or assembly '2010ClassLibrary' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Is there anyway to get around this?

If you are not using any .Net 4 features in your code in the VS2010 solution, then set your target for the solution to be .Net 2.0 instead. This will allow you to reference it in VS2005. .Net 3.5 can be used in VS2008.

you could run the app under .net 4 and then the code to load the assembly should be fine.

http://msdn.microsoft.com/en-us/library/f4kkd0k5.aspx

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