I have an application that I was writing that communicates with a third-party application via a Component Object Model
library. I must reference this COM library within the Visual Studio project itself in order for the application I am writing to work. There is also a .NET wrapper library that I must reference in the Visual Studio project in order to communicate with the COM library.
Is there a way to to create a conditional initialization of a class, in order to use a method within a .NET class within the .NET wrapper library, that will work in a later version of the third-party COM library itself.
The problem I ran into was that I was trying to reference a feature of the COM library that only existed in a later version. The version of the wrapper itself was identical because it was backwards compatible. When I attempted to access this new feature the program I was writing would silently close when I started it when the previous version of the third-party application was installed.
Is there a way I could have avoided this behavior without changing how the way the application itself was built?
$(AppVersion) == '2.0'
. Also such references confuse visual studio (references appears even when condition is false), meanwhile that answer works fine with visual studio. – Santana