Using PresentationCore and WindowsBase DLLs in x64 and x86 environments

PresentationCore.dll and WindowsBase.dll are included in the Microsoft .NET Framework 3.0, and two versions of each DLL are installed on the disk:

  • X64 version under C: \ Program Files \ Reference Assemblies \ Microsoft \ Framework \ v3.0
  • X86 version under C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework \ v3.0

Before adding links to these DLLs, our ASP.NET web application could be compiled for "any processor" and run in 32-bit or 64-bit mode without any problems. After adding a link, say, PresentationCore through the standard Add Link dialog (Add Link → .NET → PresentationCore), the web application crashes when in 64-bit mode with the following error:

Failed to load file or assembly 'PresentationCore' or one of its dependencies. An attempt was made to download a program with the wrong format.

Clearly, this is because the 64-bit application pool is trying and unable to load the 32-bit version of the PresentationCore DLL.

Now I'm a little confused by this ...

  • Other .NET Framework DLLs seem to easily switch between their x64 and x86 versions (download from Microsoft.NET/Framework64 or Microsoft.NET/Framework, respectively). Why are PresentationCore and WindowsBase not different?
  • Why does Visual Studio offer me only the 32-bit version on the .NET tab in the Add Link dialog box? If I want a 64-bit version, I have to "view" it.
  • DLL, , .NET Framework?

MSBuild xml, , , dll.NET Framework. ?

!

+5
1

.dll, . . 32- DLL. .csproj .

, , = "$ () == 'x86" Reference. Reference x64. Oracle ODP.NET:

<Reference Include="Oracle.DataAccess, Version=2.111.6.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=AMD64" Condition="$(Platform) == 'x64'">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>lib\x64\Oracle.DataAccess.dll</HintPath>
  <Private>True</Private>
</Reference>
<Reference Include="Oracle.DataAccess, Version=2.111.6.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=x86" Condition="$(Platform) == 'x86'">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>lib\x86\Oracle.DataAccess.dll</HintPath>
  <Private>True</Private>
</Reference>

, "AnyCPU". x86 x64. DLL, , , , .

1 , x86 x86/32-bit. -, 32- .

qeustions

  • , dll/executable: , x86, x64 Itanium. , 100% , AnyCPU. , (IL), , .NET Framework x86, x64 Itanium. , , , (x86, x64, IA64). , PresentationCore WindowsBase , , . IL-, , Any CPU . - PresentationCore WindowsBase.NET x86 x64, AnyCPU .
  • " " , . - x86, x86.
  • , . - CPU, x86 x64, ( x86 x64) 32- 64- DLL, . , , - , . 32- 64- . - , .
+3

All Articles