Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 4th, 2006, 08:08 AM
Registered User
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default com interop


I created an automation in .NET. When I leave all the code in one namespace everything goes well.

Recently I decided to refactor the project and put my interfaces in a general library (just a class library). I reference this library in the other libraries that use the interfaces.
The methods are still exposed etc, but when I try to instantiate (in excell (macro), or in other applications that allow the automation to be used), it throws an exception, saying that the com object can't instantiate.

The assemblies are strongnamed, classes used have a default constructor w/o parameters.

Steven Gilissen

Old October 6th, 2006, 08:45 AM
Registered User
Join Date: Oct 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Just found the solution to my problem. Rather stupid how I had to find it but hey, I learned my lesson now.

I had 2 class libraries. One of them holding the interfaces (general) & one just the classes whom are exposed (project1 for ref). When I made a setup project, I added the project output of project1, knowing that since the general project is referenced in project1, it would be copied. That's about right, but what it doesn't do is install the general dll in the GAC. I needed to effectively add the general assembly to the GAC folder of my setup.

I didn't realize earlier because I used GACUTIL/REGASM on the general dll and tried the com calls w/o rebooten my third party application (here: Excel). That was needed.

Similar Threads
Thread Thread Starter Forum Replies Last Post
C# and Interop.ShockwaveFlashObjects TheBigOnion C# 0 December 19th, 2006 12:27 PM
How to use COM Interop in C# Nataraj1978 C# 2005 0 February 17th, 2006 02:49 AM
Deploying C# COM Interop wizardjagon C# 4 February 1st, 2006 04:37 AM
Interop Problem Yehuda General .NET 0 July 1st, 2004 08:57 AM
Interop Troubles Yehuda Pro VB.NET 2002/2003 0 June 29th, 2004 01:26 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.