Currently my project support 2 versions, and now it suppose to support 3 versions.
Currently it's being done via x86
& x64
when i switch between them, in my project file i have conditions to load different assembly's, example:
<Reference Include="SExtension" Condition="'$(Platform)' == 'x64'">
<HintPath>..\..\_libBinary\ver1\SExtension.dll</HintPath>
</Reference>
<Reference Include="SExtension" Condition="'$(Platform)' == 'x86'">
<HintPath>..\..\_libBinary\ver2\SExtension.dll</HintPath>
</Reference>
So according to the platform x86
OR x64
a different assembly is getting loaded.
Acorrding to a new demand, i need to add a support for 3'rd version. (in the near future there will be another one)
I'm using TeamCity for creating the different version artifacts that the end-user gets.
TeamCity is using build steps that trigger an msbuild process,
so msbuild /p:Platform=x86
produce different artifact then
msbuild /p:Platform=x64
I thought about creating a new Configuration
named ver3
like describe in here,
and then in the project file use:
<Reference Include="SExtension" Condition="'$(Configuration)' == 'ver3'">
<HintPath>..\..\_libBinary\ver3\SExtension.dll</HintPath>
</Reference>
But i guess that it's not meant for that so i am looking for other solution.
How can i support 3'rd version?
It makes little sense switching between different features based on platform if the features do not really depend on the platform, that's just confusing. Instead just use an arbitrary property with a suitable default and pass it on the commandline. You don't even need conditions here if you set that property to the name of the directory where SExtension needs to be pulled from:
<!-- Put this at the Project Tag level, before the location where it's used -->
<PropertyGroup>
<!-- Defaults to ver1 if not specified at all -->
<ExtensionVersion Condition="'$(ExtensionVersion)'==''">ver1</ExtensionVersion>
</PropertyGroup
...
<Reference Include="SExtension">
<HintPath>..\..\_libBinary\$(ExtensionVersion)\SExtension.dll</HintPath>
</Reference>
Modify the property as usual:
msbuild /p:ExtensionVersion=ver3