Recently, a developer came up with this query :
Is there a simple way to have a single copy of my code configured to compile to different folders with different references based on the desired version of AutoCAD to be run ?
This is not strictly an AutoCAD API related query but it is very relevant to how we build plugins for AutoCAD. It is a common requirement that we add references from different paths based on the AutoCAD version for which we are building the plugin.
A simple way to get this working is to create separate build configurations in your Visual Studio solution.
Now, open the .csproj in a text editor and manually include the "Condition" for each of the references.
As an example, here is the change to include different versions of the interop assembly for Sheetset manager for each build configuration.
<Reference Include="Interop.ACSMCOMPONENTS20Lib" Condition="'$(Configuration)'=='Debug2015'">
<HintPath>..\..\..\..\ObjectARX 2015\inc-x64\ACSMCOMPONENTS20Lib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.ACSMCOMPONENTS20Lib" Condition="'$(Configuration)'=='Debug2016'">
<HintPath>..\..\..\..\ObjectARX 2016\inc-x64\ACSMCOMPONENTS20Lib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
If you are using any other technique to achieve this already, please do share by posting your comments. I am sure that will help many other developers. Thank you.