I'm new on windows phone developement and i have one problem that i don't know how to resolve....
the problem is....
i have a c++ project that i had complided with visual c++ 2010 and this create one dll with code compiled...
so i know that C# import dll libraries but when i add refrences it's make this error "Unable to retrieve assembly fullname ""Parameter name: AssemblyPath" and i dont kown what it means...
I searched on google and i found one method to import c++ dll manualy with DllImport and calling a external method... that causes one error because it's dont find the dll location... it's happens because wp7 don't suport C++???
thanks for help me
Neither P/Invoke nor C++/CLI is supported, only managed user code. See social.msdn.
3rd party WP7 apps may only comprise of managed code. C++ is also not a supported language, even in managed form, at this time.
WP7 doesn't support c++. you would also probably need to recompile the c++ dll anyways, even if it was supported.
Related
I have a dll file that was made in C++ and i need to connect it to my C# winform app to use different methods from there. I tried to give a reference to it as I done before with ordinary C# dll's but there was exception about it, because of wrong format of the dll.
After that i tried to use DllImport as i was recommended and it's works pretty good. So, my question is, is the DllImport is only solution at this situation ?
The short answer is Yes, [DllImport] is the way to import native methods.
There are others like a C++/CLI wrapper or COM, but they are more work and less fun.
I am actually trying to use a DLL on a C# project. The problem is, whenever I try to import it in my project by adding it as a reference, I get this error message :
A reference to "C:\FilePath\LnkEMP.dll" could not be added.
Check that the file is an assembly or a valid COM component
The library is "LnkEMP.dll", used for a program called Expert/M Plus. I need this library to interract with this program.
I think that this DLL is made in C++, which could be one of the reason that my C# project can't load it.
I tried to make a C++ Library and importing it, but this time I had another error message :
A reference to "C:\FilePath\LnkEMP.dll" could not be added,
because it is not an assembly .NET, or not a registered ActiveX control
Do you have any idea of what should I do to get it work ?
You can fall back on dynamic loading of dll using Win32 api calls. There should be lots of examples of dynamical loading/calling of external dll. Hopefully your dll comes with doc on how to use it.
I am doing mine FYP by using the
Visual C#
Agilent VEE
I am try to import the DLL file which created from C# into Agilent VEE but VEE required the header file and library file for the importing.
Please kindly help me.
In C#, there is no header file, this is different from C++! To use old C/C++ code, use PInvoke.
You cannot consume a c# dll in your C++ project and vice versa (normally). You should either create a com aware dll in C# to consume it in C++ or on the other hand, you need to declare all the functions in C# to use from a c++ dll.
Here I am talking about standard dlls (not activex or com all). They require a different methodology to work with.
Perhaps you can avoid the "Import Library" primitive in VEE, and not need a header file.
Use Device --> .NET Assembly References... and browse to your DLL files. Then you have to import or select a namespace. Finally, functions of the DLL appear in the function browser of VEE.
Not all DLL files can be used. I have two similar from a hardware vendor. The one named somename_net.dll works.
If you find an answer to your original question, I'd like to know. My method
I took a program written in C/C++ and modified it's main function to accept some arguments as input and return a variable as output and created a Win32 DLL out of it. I then created a .NET DLL which uses InterOp to access the first DLL. Now when I load the .NET DLL in my C# app I get a System.DllNotFoundException from the DLL which is really baffling me as there were never memory issues with the program and both Win32/.NET dlls are located in the same directory (apart from modifying the main function, the code has not really changed).
The solution was provided in this thread, which was my original question some time ago. I'm pretty sure that answer is correct but I'm just missing something.
You can download my VS solution Here. The solution contains three projects: the Win32 DLL, the .NET DLL, and a winform app that references the .NET DLL (but when trying to test gives the DLL exception). Any help or debugging guidance would be greatly appreciated.
UPDATE: I have tried all the tips/suggestions below but I still get the exact same error. If it makes things easier, my VS solution is available to download in the hyperlink above.
Make sure you have placed the win32 dll on /windows/system32 folder(if only the dll name is passed to DllImport)
Alternatively you can also pass the full path of the dll to the DllImport Attribute.
Use a tool such as Dependency Walker to make sure you are not missing out on any dependent assembly.
I have a DLL (Test.dll) which contains some Excel Addin, i don't know which version this is build with (might be with VB6, but i am not sure).
When i tried referencing this DLL in the VS2008 i get the message
A reference to the <DLL Name> could not be added. Please make sure that the file is accrssible, and that it is a valid assembly or COM Component.
If anyone could please help me in this, it will be great.
Any help is appreciated.
Thanks and Regards,
Tushar
It seems to me the DLL you're trying to load isn't a managed DLL, or one that the CLR can treat as managed.
One solution would be to use managed C++ (C++/CLI) to build a wrapper around the DLL. Another is to use PInvoke which is explained here and there's a tool for it I came across here.
You can also look in this thread: Unable to Use DLL of VB6 Into ASP.NET.
Hope one these work out for you,
Asaf