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: Mon, 20 Aug 2007 06:56:02 -0700,    posted on: microsoft.public.dotnet.framework.interop        back       

Thread Index
  1    Pablo Sullivan
          2    Christian Fröschlin
                 3    Pablo Sullivan
                 4    Christian Fröschlin


c# x64 COM Add References Problem   
I have a problem building a c# project that references a COM object built for 
x64.  The problem is that the x64 DLL is missing under the "Add References" 
COM tab for the C# project.  Also when I attempt to add a reference via the 
BROWSE tab, an error message is displayed saying “Please make sure that the 
file is accessible and, that it is a valid assembly or COM component.”
I can regsvr32 the DLL and instantiate objects in the DLL via JavaScript, so 
it is unclear why Visual Studio cannot find it.  Maybe it has to do with 
Visual Studio running in 32 bit mode.
My machine is running an Intel(R) Pentium(R) D CPU with Windows XP 
Professional x64 Edition, and I am running Visual Studio 2005, The C# project 
settings are “Any CPU” and the settings for the C++ ATL COM project are:
Project- x64
Linker/Advanced/Target Machine	- x64
MIDL/General/Target Environment- x64
If I change the MIDL/General/Target Environment to 32-bit then the DLL does 
show up under Add References of the c# project.  Unfortunately this is not a 
solution since the DLL has to run as x64.
Does anyone have any ideas as to how to solve this?
Thank you for any help you can provide.
Date:Mon, 20 Aug 2007 06:56:02 -0700   Author:  

Re: c# x64 COM Add References Problem   

> If I change the MIDL/General/Target Environment to 32-bit then the DLL does 
> show up under Add References of the c# project.  Unfortunately this is not a 
> solution since the DLL has to run as x64.

> Does anyone have any ideas as to how to solve this?


You need both versions of the DLL and you can register both of
them as Win64 keeps a separate registry section for the WOW64
stuff. Visual Studio 2005 will only see the 32-bit version
but when you run the app it loads the 64-bit version.
Date:Mon, 20 Aug 2007 16:13:05 +0200   Author:  

Re: c# x64 COM Add References Problem   
"Christian Fröschlin" wrote:


> > If I change the MIDL/General/Target Environment to 32-bit then the DLL does 
> > show up under Add References of the c# project.  Unfortunately this is not a 
> > solution since the DLL has to run as x64.
> 
> > Does anyone have any ideas as to how to solve this?
> 
> You need both versions of the DLL and you can register both of
> them as Win64 keeps a separate registry section for the WOW64
> stuff. Visual Studio 2005 will only see the 32-bit version
> but when you run the app it loads the 64-bit version.
> 

Thanks for your response.  We have solved it by adding the following 
Post-Build-Event to my C++ project:  tlbimp /machine:x64 "MyX64Com.DLL".  
This generates MyX64ComLib.DLL which enables COM interop between my C# 
program and MyX64Com.DLL.  Apparently, Visual Studio omits TLBIMP after 
building and registering x64 COM C++, which was the source of the problem, 
but Visual Studio does not omit TLBIMP after building and registering x32 COM 
C++, which explains my original observations.
Date:Wed, 22 Aug 2007 18:28:00 -0700   Author:  

Re: c# x64 COM Add References Problem   

> Thanks for your response.  We have solved it by adding the following 
> Post-Build-Event to my C++ project:  tlbimp /machine:x64 "MyX64Com.DLL".  
> This generates MyX64ComLib.DLL which enables COM interop between my C# 
> program and MyX64Com.DLL.


Ok, so you reference the wrapper assembly in your c# project and
not the COM dll? You would still need a 32-bit version if your
DLL contained ActiveX controls for use in the form designer,
otherwise it should work fine.
Date:Thu, 23 Aug 2007 09:53:20 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


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