I have a c# .net winforms solution and I want to create two different builds: one that supports IE6 and one that supports IE7. A few of the files in one of my projects are d
Assuming you are using VS2005 or above you can use the Condition property in the project file.
You'll need to edit the csproj file directly
then on the files you want to conditionally include
<Compile Include="IE6.cs" Condition=" '$(Platform)' == 'IE6' " />
<Compile Include="IE7.cs" Condition=" '$(Platform)' == 'IE7' " />
<Compile Include="IE.cs" />
In order to add the same file in two or more projects you can
Right click on the project and choose Add >> Existing Item
Choose the file in the filepicker
Click the little triangle on the right side of the Add button in the file picker
Choose Add As Link
This will add the file to the project without making a copy of it.
I don't know all the details of your situation, but you're solution sounds awkward. Two versions of the same dll is likely to lead to configuration problems on client computers eventurally. I encourage you to consider Kevin's idea of a single dll with all capabilities, and calling the appropriate code as needed.
In MSBuild, you can specify conditions to item groups. You can then bind those conditions to the target device.
Example:
<!-- Declare the condition property at the beggining of the build file -->
<PropertyGroup Condition="$(Platform) == 'IE7'">
<UseNewLibrary>true</UseNewLibrary>
</PropertyGroup>
<PropertyGroup Condition="$(Platform) == 'IE6'">
<UseNewLibrary>false</UseNewLibrary>
</PropertyGroup>
<!-- Then those the property to select the right file -->
<ItemGroup Condition="$(UseNewLibrary)==true">
<Compile Include="Class1.cs"/>
<Compile Include="Class2.cs"/>
<Compile Include="Class3.cs"/>
<Compile Include="Class4.cs"/>
</ItemGroup>
<ItemGroup Condition="$(UseNewLibrary)==false">
<Compile Include="Class1Old.cs"/>
<Compile Include="Class2Old.cs"/>
<Compile Include="Class3Old.cs"/>
<Compile Include="Class4Old.cs"/>
</ItemGroup>
<!-- And now references -->
<ItemGroup Condition="$(UseNewLibrary)==true">
<Reference Include="MyAssembly, Version=1.1.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</ItemGroup>
<ItemGroup Condition="$(UseNewLibrary)==false">
<Reference Include="MyAssembly, Version=1.0.6.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</ItemGroup>
Note that all files will appear in the IDE, but at compile time everything should align correctly.
Then, all you need to do is create your platforms (IE6 and IE7) in the configuration management.
You can also directly use the platform property instead of creating an intermediate property.
I'm not sure how to do what you're asking, but couldn't you just include both versions of your API wrapper in the dll and determine which one to call at runtime? For example, what if a user installs the IE6 version of your app then upgrades to IE7? They'll need to reinstall, right?
It seems to me like this would be a much simpler solution, but maybe I'm missing something...