I haven't found a way to get my .Net 4.0 application to run in Map 2010. It works in 2012, and in 2011 if you change the acad.exe.config file and uncomment the below lines of code it works:
<startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0"/> </startup>
However, in Map 2010 it doesn't work. There is a line of code in the same acad.exe.config that is similar to the above but it targets the 3.5 framework. I've tried adding the v4.0 into the 2010 config and it causes a fatal error in Map. (I do get a kick out of the comment in the 2010 config file "We always use the latest .Net framework, etc. etc.")
Anyway, is it possible to run a .Net 4.0 app in 2010?
Map 2010 does not use the 4.0 runtime as far as I know (because it didn't exist then), so it's not possible to load .net 4.0 applications/libraries into it.
The latest .net framework at the time of Map 2010 is v3.5. So the ideal option is to re-build your app to target the 3.5 framework, and unless you're using 4.0 stuff like TPL and C# dynamic keyword this should be nothing more than a switch in your project settings.
Thanks for the response Jackie. I did find a few little quirks with 2011, and 2012 to run V4 which I got to work fine. There is a switch in the acad.exe.config file that needs to be uncommented. One I did that I could get it to run in the newer versions of acad. However, since 2010 is still in use, I have went back to 3.5 sp1.
On a side note, there is an issue with vs2010. I was using vs 2010 to do this appliation and when compiling the project in 3.5 from vs 2010 there is a bug with the complier, it does not like the microsoft.sqlserver.ManagedDTS.dll file which is installed as part of the SQL server 2005 SDK. There is a version of a file that needs to be loaded from the SQL 2008 SDK which is supposed to fix that problem. Just a heads up for anyone building apps for Autocad .Net framework that uses dts.