Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi.
Im working in a new WebSite project. Im migrating a WinForm project to my new Asp.Net WebForm
The WinForm use a DLL(C++/CLI) as a reference and works fine

The problem is, when I try to use that DLL(C++/CLI) for my Website project, an error appears:
The located assembly's manifest definition does not match the assembly reference
(Excepción de HRESULT: 0x80131040)

I cannot Build the web site beacuse of that issure.

I have been lookinf that issure in the web but I cannot solved it
Im using:
Windows 7 64bits
Visual Studio Profesional 2010
The Winform project is Build on 32bits
The project that built the DLL(C++/CLI) is on Win32

I also tried to use REGSVR32 to add my DLL
I
Can you help me please
Thanks

PD: Sorry for the bad english, I still learning
Posted
Comments
Sergey Alexandrovich Kryukov 24-Feb-14 21:09pm    
This is unsolvable; you need to change your target architectures, on one or more projects. I answered, please see Solution 2.
Please don't post non-answers as "solution".
—SA
memd24 25-Feb-14 10:39am    
Sry I forgot that Im using C# and Framework v4

1 solution

I don't see how you referenced the "DLL" (actually, the assembly, the notion of "DLL" is not essential in CLI), so I am not sure what's wrong.

I would advise to re-reference this assembly.

First, removed the reference. Then, make sure you add all inter-depending project in one solution. Now, you want to use you assembly in one or more projects. Add the reference, and, in the "Add Reference" Window, use, the "Projects" tab. This will take care of automatically correct assembly reference even if you change the project's properties.

[EDIT]

I just noticed that one of the projects is compiled to 64-bit and another in 32-bit. This is impossible. You can never use assemblies compiled to different instruction-set architectures in one process.

First of all, there is no such thing as 64-bit architecture. It is either x86-64 or IE64 (Itanium), they are incompatible to each other, and each of them should be compatible with actual target CPU. Not so with x86. It is compatible with all architecture and uses WoW64 on 64-bit Windows:
http://en.wikipedia.org/wiki/X86[^],
http://en.wikipedia.org/wiki/X86-64[^],
http://en.wikipedia.org/wiki/Itanium[^],
http://en.wikipedia.org/wiki/WOW64[^].

What to do? First of all, I have no idea why do you compile project for concrete architecture. The very best "architecture" is "Any CPU". Use it in all cases, when you don't have very special reason to use the concrete architecture. (You only need to use concrete architecture is some native code is involved, for example, via P/Invoke). "Any CPU" is compatible with any of the concrete architecture, but two different concrete architectures cannot leave together, ever.

"Any CPU" is possible because .NET is based in JIT compilation. Your compilers produce IL code which is compiled to native instruction set during runtime:
http://en.wikipedia.org/wiki/JIT-compilation[^].


—SA
 
Share this answer
 
v2
Comments
memd24 25-Feb-14 10:38am    
Where did I said that one project is compiled to 64-bit? Both project are in 32bits
I tried using "Any CPU" for both project but nothing.
Also I referenced the project of the dll but the same issure
Sergey Alexandrovich Kryukov 25-Feb-14 11:35am    
Right, you didn't. Sorry, I failed to get it. Then please use only the first part of my answer, before [EDIT].
—SA
memd24 25-Feb-14 14:54pm    
Thanks for help me.
I added the project as a reference.
but a new issure replace the another:
Could not load file or assembly 'F3BC4DNI.DLL' or one of its dependencies. Can not find the specified module.
I guess because the Website cannot find de path of the dll from the c++ project
Sergey Alexandrovich Kryukov 25-Feb-14 16:32pm    
It depends on where is that DLL. In GAC or not. How did you reference it?
—SA
memd24 28-Feb-14 12:31pm    
I referenced it browsing the dll, I pastes the dll in the root of my project

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900