C# preprocessor directive or conditional for differentiating between Visual Studio 2012 and 2010? -


i have c# code works in visual studio 2012 use visual studio 2010 on same codebase. there preprocessor directive or conditional can use isolate code?

no built in pre-processor directive far know, there msbuild variable.

open project file (unload in solution explorer, click edit) , add following after main set of property declarations.

<propertygroup condition="'$(visualstudioversion)' == '10.0'">   <defineconstants>$(defineconstants);vs_10;</defineconstants> </propertygroup> <propertygroup condition="'$(visualstudioversion)' == '11.0'">   <defineconstants>$(defineconstants);vs_11;</defineconstants> </propertygroup> 

you can use vs_10 (vs 2010) or vs_11 (vs 2012) preproc directives.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -