Click here to Skip to main content
11,641,659 members (62,874 online)
Rate this: bad
good
Please Sign up or sign in to vote.
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 24-Feb-14 13:01pm
memd24271
Comments
Sergey Alexandrovich Kryukov at 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 at 25-Feb-14 10:39am
   
Sry I forgot that Im using C# and Framework v4

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
v2
Comments
memd24 at 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 at 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 at 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 at 25-Feb-14 16:32pm
   
It depends on where is that DLL. In GAC or not. How did you reference it?
—SA
memd24 at 28-Feb-14 12:31pm
   
I referenced it browsing the dll, I pastes the dll in the root of my project
Sergey Alexandrovich Kryukov at 28-Feb-14 13:37pm
   
Do you mean "Add Reference" Window, "Browse" tab? If you added the reference, can you browse it in Visual Studio after you click on its node in Solution Explorer?
—SA
memd24 at 28-Feb-14 17:59pm
   
Yes, I added as a reference using the Browse button. Yes, I can se the reference in the reference folder

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

  Print Answers RSS
0 Mika Wendelius 310
1 DamithSL 213
2 Afzaal Ahmad Zeeshan 139
3 CPallini 134
4 OriginalGriff 120
0 Mika Wendelius 460
1 OriginalGriff 215
2 DamithSL 213
3 CPallini 169
4 Afzaal Ahmad Zeeshan 129


Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 25 Feb 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100