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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually a combination from FernandoSoto's answer and mine would solve your problem i think.
ASKER
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.