How to downgrade C++/Cli framework version to v2.0 using VS2012

  • 100
  • 0
  • 2017-01-19

Default VS2012 C++/Cli project framework version is v4.0. Here are the steps to compile DLL to downgrade C++/Cli framework version to v2.0.

  1. Install VS2008 and VS2010
  2. Create a CLR project named "Hello" for example
  3. Right click "Hello" project and select "Unload Project"
  4. Right click "Hello(unavailable)" and select "Edit Hello.vcxproj"
  5. Change TargetFramewrokVersion from "v4.0" to "v2.0"
  6. Change PlatformToolset tag from "V110" to "v90"
  7. Save and close project file
  8. Right click "Hello(unavailable)" and select "Reload project". The project title will be changed as
  9. Change version number in "AssemblyInfo". Using default "1.0.*" will cause error when use function in DLL.
  10. Rebuild project and enjoy the DLL in .netframework2.0
  11. Pay attention that when reference this DLL in .netframework4.0 project, you have to set useLegacyV2RuntimeActivationPolicy="true" in startup tag in app.config as