views:

45

answers:

1

Is it possible to add to my C# project a reference to a different dll versions in x86 and x64 (and switch automatically between them, while changing Configuration Mode)?

+4  A: 

I don't think there's anything in the IDE that will do this, but you can probably accomplish this by manually editing the C# project file.

Something that looks like: <Reference Include="ThirdPartyAssembly" />

Could be changed to: <Reference Include="ThirdPartyAssembly.x86" Condition="'$(Platform)' == 'x86' /> <Reference Include="ThirdPartyAssembly.x64" Condition="'$(Platform)' == 'x64' />

That is entirely compile time, he needs it most probably at runtime.
Dykam
@Dykam: I thought it was pretty clear in the original question that rook wanted a compile time solution.
Mattias S
Somehow I read "change Configuration Mode" as runtime mode... I take it back.
Dykam
Works as a charm, thanks! In fact both dlls appear in the 'References' section in the Solution Explorer, but only one is loaded. Another is shown as if it was unresolved. It works fine, though.
rook