Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

calling a dotnet com object created via COM class template from vb6 on user's machine

Posted on 2009-07-10
19
Medium Priority
?
461 Views
Last Modified: 2012-05-07
I have created a com object using the COM class template but what do I need to do to deploy it to other computers.
0
Comment
Question by:bmutch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 10
  • 7
19 Comments
 

Author Comment

by:bmutch
ID: 24826447
I put the dotnet com dll in the app folder, ran regasm on it successfully, and it still won't call the dll from the vb6 app.
0
 

Author Comment

by:bmutch
ID: 24826558
Well, I have it working, but in my calling app I had to use late-binding, is it possible to use early binding, ie.
dim dotnetclass as dotnetclass
... etc...
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24840358
If you have the ProgID for the COM component, then you can use the CreateObject or GetObject calls for late-binding to COM classes.

Examples can be found here:

CreateObject Function (Visual Basic)  
http://msdn.microsoft.com/en-us/library/7t9k08y5(VS.80).aspx


Dim adoApp As Object
adoApp = CreateObject("ADODB.Connection")
 
 
   Dim xlApp As Object
    ' Replace string "\\MyServer" with name of the remote computer.
    xlApp = CreateObject("Excel.Application", "\\MyServer")
    MsgBox(xlApp.Version)

Open in new window

0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:bmutch
ID: 24840860
well, I really don't want to develop "blind" like that, I need early binding as I mentioned above, and I found a vs2003 template to create a c# page that will make a class that enabled this. But now I still need to know how to deploy this to clent computers. I ran regasm manually and it worked, but what is the best way to do it via some sort of "setup" program?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24840976
Geez, Monday morning blues (d'oh).

I read that comment incorrectly.  You want early-binding, and not late-binding.  Are you working with 1.1 or 2.0/3.5?
0
 

Author Comment

by:bmutch
ID: 24843273
I'm using 3.5, and only thing left to do is "register" the dotnet com componenet on client machines.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24844084
There is an option in the properties for an assembly:  Register = vsdraCOM
0
 

Author Comment

by:bmutch
ID: 24853813
Is this in the assembly's project or in a Setup and Deployment project to deploy the assembly. Is there any other way other than creating a Setup and Deployment project? Can I just run regasm directly (like when the calling program starts up somehow to check to see if the assembly is registered and if it isn't then run regasm- I don't know how to check to see if it is registered, com dll's are easy to check) Also, how do I find the path to regasm?

thanks.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24853858
What type of deployment are you talking about?  You could use a batch file to XCOPY deploy the assembly and run regasm.  Also, it doesn't matter if you run regasm, even if it is registered already, so you don't need to check.
0
 

Author Comment

by:bmutch
ID: 24884811
Where is the location of regasm, would it depend on the framework version running on the computer:?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24886850
Regasm is in the framework version-specific folder (i.e. C:\Windows\Microsoft.NET\Framework\v2.0.50727).
0
 

Author Comment

by:bmutch
ID: 24892304
this seems pretty messy:
Can a computer have multiple frameworks installed, ie, if you upgrade frameworks on a computer can it still use the old framework versions? In VS if I set a specific version as the "target" what happens if that version is not installed on a computer?
thanks.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24894742
You can have multiple frameworks installed, and each can work independently.  If you target a specific version of a .NET framework, then it must be present in order for the application to run correctly.  

You can require a particular version of the CLR runtime, with config settings:

App.config Examples
http://blogs.msdn.com/suzcook/archive/2004/05/14/132022.aspx
Forces the v1.0 CLR to be run. If the v1.0 CLR is not installed, the app will fail to run.
 
<?xml version ="1.0"?> 
 <configuration> 
    <startup> 
         <requiredRuntime version="v1.0.3705"/> 
         <supportedRuntime version="v1.0.3705"/> 
     </startup> 
 </configuration>

Open in new window

0
 

Author Comment

by:bmutch
ID: 24897580
I would think that if I am targeting 3.5 framework I would find the correct regasm.exe to use in that folder, but a search of my dev. computer shows regasm only in the v1.0.3705, v1.1.4322 and v2.0.50727 folders. Given this how do I find the correct regasm to run on the clinet computer.
thanks?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 24898121
3.5 and 3.0 both still use the 2.0 folder, since the REGASM didn't change from 3.0 and 3.5.
0
 

Author Comment

by:bmutch
ID: 24898608
aha, thank you very much. I think I'm finally good to go.
0
 

Author Closing Comment

by:bmutch
ID: 31602216
excellent, thanks.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question