DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 02 Aug 2007 06:57:19 -0000,    posted on: microsoft.public.dotnet.framework.compactframework        back       

Thread Index
  1    Treadstone
          2    Peter Foot [MVP]
          3    Ben


Unable to Add C++ Dll in C# project   
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
Date:Thu, 02 Aug 2007 06:57:19 -0000   Author:  

Re: Unable to Add C++ Dll in C# project   
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

-- 
Peter Foot
Microsoft Device Application Development MVP
www.peterfoot.net | www.inthehand.com
In The Hand Ltd - .NET Solutions for Mobility

"Treadstone"  wrote in message 
news:1186037839.364369.111270@q3g2000prf.googlegroups.com...

> 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
> 
Date:Thu, 2 Aug 2007 12:40:09 +0100   Author:  

Re: Unable to Add C++ Dll in C# project   
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

On Aug 2, 4:57 pm, Treadstone  wrote:

> 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
Date:Thu, 02 Aug 2007 04:48:00 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us