Link to home
Start Free TrialLog in
Avatar of jisha123
jisha123

asked on

How to compile only certain part of the code in .net.

Hi,
      I have a C# application in which i am using a Interop COM Dll properties of which are slightly different in two versions.I want  to have a single project  for this application which should support both version.But i now the version only at runtime. So i want to compile certain code based on the current version.How do i do that ?I tried with #if but could not succeed.Kindly help.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jisha123
jisha123

ASKER

Hi,
   Thank for your suggestion.But in my case i will be adding COM dll reference at design time.There are certain properties or methods in each dll (each version) which are not supported in the other.So i cannot just write a
if {} else statement because , irrespective of version both code will compile and methods or properties which are not supported will through error while compling.Kindly help in this.
Actually a combination from FernandoSoto's answer and mine would solve your problem i think.