Unable to Add C++ Dll in C# project

T

Treadstone

Hi,

I am trying to add a dll (created as a VC++ project) in VS2005 to a C#
project for a Smart Device.
Each time I try to add reference, an error message is thrown up
stating "Unable to add Dll".

Following are the steps I followed:

1. Add New Project -> VC++ -> Smart Device -> Win32 Smart Device
Project -> Dll
2. Build project (Test.dll). (empty dll project for testing)
3. In my C# project, Add reference -> Test.dll

At this point it throws up an error stating "A reference to Test.dll
could not be added".

I tried registering the Dll with "regasm" but even that threw an error
stating "Test.dll is not a valid .Net assembly"

Is there something wrong with the procedure followed by me or is it
some other issue (like an installation issue)?

Thanks in advance,
Treadstone
 
P

Peter Foot [MVP]

You cannot add a native DLL as a reference. What you are probably trying to
do is to P/Invoke some function in the native DLL in which case you need to
write your P/Invoke declaration in your managed code.

Peter
 
B

Ben

I dont think you can add non CLR dlls to a Compact app , You can call
them via pinvoke manually, but they need to be on the device
already . You should be able to add the output to a cab deployment
project .

Considering all the pinvokle stuff you have to do to call native dlls
why do you think you can just add a reference ?

Regards,

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top