Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Site: MSB3270: There was a mismatch between the processor architecture

I have a Web Forms Web Site project. This web site references 4 class library projects. 3 of these class libraries reference a third-party assembly. I am getting the following compiler error for each of the 3 class library projects.

ASPNETCOMPILER : error ASPCONFIG: Could not load file or assembly 'myAssembly' or one of its dependencies. An attempt was made to load a program with an incorrect format. [Project. metaproj]

I have tried all possible combinations of AnyCPU/x86/x64 on the class library projects. I cannot change this on the Web Site project. I have both a x86 and x64 version of the third-party dll. Tried both.

"ClassLibrary.csproj" (default target) (4) -> (ResolveAssemblyReferences target) -> C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1561,5 ): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "ThirdPartyDll, Version=xxx, Culture=neutral, processorArchitectu re=x86", "x86". This mismatch may cause runtime failures. Please consider chang ing the targeted processor architecture of your project through the Configurati on Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture th at matches the targeted processor architecture of your project. [ClassLibrary.cspro j]

The bellow illustrates the solution configuration. Note I cannot change from "AnyCPU" here, only from within each individual class library project.

Solution configuration

All .NET 4

Converting the Web Site to a Web Application is not an option.

Thanks,

like image 781
Sam Leach Avatar asked Jul 27 '12 15:07

Sam Leach


1 Answers

Obviously, you have a native 32 bit DLL. So the application pool on IIS must be configured to run the .NET framework in 32 bit mode.

This can be configured in the IIS Manager. Go to "Application Pool", select the relevant application pool and open the "Advanced Settings..." dialog. The 32 bit option is close to the top.

like image 191
Codo Avatar answered Oct 25 '22 15:10

Codo