Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is possible to conditionally reference each the .dll file that matches your active build configuration. You'll need to manually edit your project file. Add a reference to the 32-bit DLL. Then save the project and edit the .csproj file in a text editor.</p> <p>Search for the reference that you added and add Condition="$(Platform) == 'x86'" as an attribute on the Reference element. Then make another copy of the Reference element and tweak it for the x64 version. Here's an example with the Oracle ODP.NET drivers:</p> <pre><code>&lt;Reference Include="Oracle.DataAccess, Version=2.111.6.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64" Condition="$(Platform) == 'x64'"&gt; &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt; &lt;HintPath&gt;lib\x64\Oracle.DataAccess.dll&lt;/HintPath&gt; &lt;Private&gt;True&lt;/Private&gt; &lt;/Reference&gt; &lt;Reference Include="Oracle.DataAccess, Version=2.111.6.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" Condition="$(Platform) == 'x86'"&gt; &lt;SpecificVersion&gt;False&lt;/SpecificVersion&gt; &lt;HintPath&gt;lib\x86\Oracle.DataAccess.dll&lt;/HintPath&gt; &lt;Private&gt;True&lt;/Private&gt; &lt;/Reference&gt; </code></pre> <p>One important thing to note is that you'll no longer be able to use the 'AnyCPU' configuration. You will need to have explicit build configurations for x86 or x64. The .dll you are trying to use is likely making native calls into OS libraries so your project can no longer be platform agnostic.</p> <p>If you only want to maintain 1 build configuration, you can go with x86 and use only the x86/32-bit version. If it's a web application, you will need to put the app pool into 32-bit mode.</p> <p><strong>Edited to answer your original qeustions</strong></p> <ul> <li>You have a handful of platform options when you build a dll/executable: Any CPU, x86, x64, or Itanium. Code that is written 100% in managed code and has no dependencies on native libraries are generally compiled &amp; distributed as AnyCPU. This is because the resulting intermediate language (IL) code generated by the compiler can run on the x86, x64, and Itanium versions of the .NET Framework. Libraries that target Any CPU can be referenced safely from applications that are platform specific (x86, x64, IA64). The reason that PresentationCore and WindowsBase are different is because they have dependencies on native code. Unlike IL-code, which is interpreted at runtime, there is no concept of Any CPU in native code. Because of the native code dependencies, the PresentationCore and WindowsBase .NET libraries needed to be distributed as x86 and x64, as AnyCPU is not possible.</li> <li>The Add Reference dialog should only show you libraries that are compatible with the platform that you're targeting. If your Target Platform is x86, it should only show you Any CPU and x86 libraries.</li> <li>Unfortunately, no. If you can't use Any CPU, but still need to support x86 and x64, then you need to setup multiple build configurations (one for x86 and one for x64) and conditionally reference the 32-bit and 64-bit dll's you need. The only way I know of to do this is to edit the project file as detailed above. You will need to build both configurations and distribute separate 32-bit and 64-bit versions of your code as well. If anyone depends on your code, they will need to jump through the same hoops.</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload