joi, 19 ianuarie 2012

Could not load file or assembly or one of its dependencies.

The full error text is in fact:

Could not load file or assembly 'xxx.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format
and may occur when using Visual Studio 2005 on 64-bit platforms. A common cause of this error is when using third party tools that require the license compiler (lc.exe). On 64 bit systems, the license compiler will run as a 64-bit application by default and if the third party libraries are not compatible with 64-bit platforms, the aforementioned error is generated. One solution to fix this, even though in this case you will be limited to compiling your whole application in x86 mode, is to add the following code in the pre-build and post-build event sections of the project's Build Events section. The statements must be on a single line.

Pre-Build:

if exist %WINDIR%\Microsoft.NET\Framework64\v2.0.50727\ %WINDIR%\Microsoft.NET\Framework64\v2.0.50727\ldr64.exe setwow
Post-Build:
if exist %WINDIR%\Microsoft.NET\Framework64\v2.0.50727\ %WINDIR%\Microsoft.NET\Framework64\v2.0.50727\ldr64.exe set64
For more information on the license compiler, see this post on MSDN: http://msdn.microsoft.com/en-us/library/ha0k3c9f.aspx. I must say I have tried other solutions, as explained in other blogs or forums on-line, which advise to change the target platform to x86 or Any CPU, but those did not work for me.

Niciun comentariu:

Trimiteți un comentariu