Re: using unmanaged dlls from managed dll wrappers.
- From: "Lloyd Dupont" <net.galador@ld>
- Date: Thu, 2 Feb 2006 15:45:04 +1000
you misunderstood me.
copy the unmanaged DLL in some directory next to your solution.
right click on your project => properties => build event
in the appropriate text box write: "copy /y $(SolutionDir)../bin/myDll.dll
$(TargetDir)"
--
Regards,
Lloyd Dupont
NovaMind development team
NovaMind Software
Mind Mapping Software
<www.nova-mind.com>
"drawing in aspnet" <csharpuser@xxxxxxxxxxx> wrote in message
news:1138852970.420253.246970@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Lloyd,
>
> Thanks for the response. I tried copying the unmanaged dll to the
> correct directory (manually), and that did not work. I will try the
> "Add the unmanaged DLL project in your solution and reference it"
> option tomorrow. However, this is not an ideal solution. For
> instance, I might want to distribute the unmanaged dll (and the managed
> C++ wrapper), without source code.
>
> Dave.
> Lloyd Dupont wrote:
>> Hi!
>>
>> This is just a DLL mumbob-jumbo!!
>>
>> I was surprised when you said you a reference to the unmanaged DLL to
>> your
>> managed C++ wrapper.
>> But in fact you probably add a PROJECT reference.
>>
>> Anyway you're right, the problem is that the .NET runtime can't find your
>> unmanaged DLL because it's not in the directory.
>> To solve that you should either:
>> 1. Use a custom build action (project properties) which will copy the dll
>> after successfull compilation
>> 2. Add the unmanaged DLL project in your solution and reference it.
>>
>> --
>> "drawing in aspnet" <csharpuser@xxxxxxxxxxx> wrote in message
>> news:1138826132.728910.313210@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>> > Hi,
>> >
>> > I hope someone can direct me to the correct newsgroup if this one is
>> > not correct.
>> >
>> > I have a unmanaged C++ dll that I need to use from a C# client. Rather
>> > than use dllImport directly, I created a managed C++ dll (in the same
>> > solution). In this managed C++ dll, I added a reference (under
>> > references) to the unmanaged dll (it's listed under the project tab).
>> > I also had to #include the header file for the unmanaged dll in my
>> > managed code.
>> >
>> > Then I created a C# client (.exe.) in my solution to test this idea.
>> > In the C# client I simply added a reference to the managed C++ dll.
>> > All worked great and I was happy.
>> >
>> > Now two weeks later, I would like to use this stuff from a real
>> > project. From a C# class library (which is used by my C# exe), I call
>> > into my C++ managed dll. I of course had to add a reference to the C++
>> > managed dll. Everything compiled. However, when I run, I get the
>> > following runtime error:
>> >
>> > An unhandled exception of type 'System.IO.FileNotFoundException'
>> > occurred in CSharpLibrary.dll.
>> >
>> > Additional Information: File or assembly name ManagedConverterWrapper,
>> > or one of its dependencies, was not found
>> >
>> > ManagedConverterWrapper is the managed C++ wrapper I wrote.
>> >
>> > I tried adding a reference in my C# class library to the unmanaged C++
>> > dll using the 'Add Reference' tab. It did not work (got error saying
>> > could not add non DotNet dll) . Curiously, I was able to add a
>> > reference to the unmanaged dll to my managed C++ dll. Was that because
>> > it was within same solution or does C++ behave differently with respect
>> > to adding references.
>> >
>> > I also tried copying the unmanaged dll everywhere I could think of
>> > (bin/debug of C# class library and C# exe). No luck!
>> >
>> > My questions are:
>> >
>> > 1. When one uses a managed C++ dll that in turn makes use of unmanaged
>> > dlls, what else must one do to get things working? I.e. Compiler
>> > settings, additional references, file copying, etc.
>> >
>> > 2. Why did everything work fine when all the project where within one
>> > solution?
>> >
>> > Thanks in advance for any pointers, advice or references.
>> >
>> > Dave.
>> >
>
.
Relevant Pages
- Re: using unmanaged dlls from managed dll wrappers.
... This is just a DLL mumbob-jumbo!! ... I was surprised when you said you a reference to the unmanaged DLL to your ... But in fact you probably add a PROJECT reference. ... File or assembly name ManagedConverterWrapper, ... (microsoft.public.dotnet.framework) - Re: using unmanaged dlls from managed dll wrappers.
... "Add the unmanaged DLL project in your solution and reference it" ... File or assembly name ManagedConverterWrapper, ... (microsoft.public.dotnet.framework) - Re: using unmanaged dlls from managed dll wrappers.
... manuall copy the unmanaged DLL in the same directory as your managed ... In the C# project I add a reference to the managed ... ManagedConverterWrapper is the managed C++ wrapper I wrote. ... (microsoft.public.dotnet.framework) - Re: using unmanaged dlls from managed dll wrappers.
... I'm afraid I still cannot get it to work by copying the dll. ... In the C# project I add a reference to the managed ... I have copied the unmanaged dll to ... File or assembly name ManagedConverterWrapper, ... (microsoft.public.dotnet.framework) - RE: VS.NET 2003 Project References
... The "Add Reference" feature is mainly designed for the managed code ... component or the previous stuffs in projects), for adding an unmanaged DLL ... dependency to an unmanaged project like MFC application, ... (microsoft.public.vsnet.general) |
|