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
精彩评论