Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7732403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:43:19+00:00 2026-06-01T06:43:19+00:00

I have declared C++/CLI class as below namespace testcominterface { [ComVisible(true)] [Guid(FFCA805F-8DAB-4AF8-A7B7-B488136E8177)] public interface

  • 0

I have declared C++/CLI class as below

namespace testcominterface {

  [ComVisible(true)]
  [Guid("FFCA805F-8DAB-4AF8-A7B7-B488136E8177")]
  public interface class ITestInterface
  {
      public :
          void TestMethod();
  };


  [ComVisible(true)]
  [Guid("E65F4772-54B5-4105-83E5-DCED24ABC815")]
  [ClassInterface(ClassInterfaceType::AutoDual)]
  [ComDefaultInterface(ITestInterface::typeid)]       
  public ref class testCoClass : ITestInterface
  {
      public:
          virtual void TestMethod()
                {

                    Console::WriteLine("testCoClass::TestMethod : Test method");

                }
  };
 }

And I want to create the “testCoClass” through native C++ COM (by #import the TLB file and use CoCreateInstance) I always get an error “Class Not Registered”. If I use “Regasm.exe” to register the assembly it works fine, but I don’t want to register the assembly.

I have followed the steps in this blog post http://blogs.msdn.com/b/cheller/archive/2006/08/24/how-to-embed-a-manifest-in-an-assembly-let-me-count-the-ways.aspx to embedded manifest into the Assembly, but it didn’t work.
(Note that this method always works with C# assembly, but this is a C++/CLI assembly.

I appreciate any suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:43:20+00:00Added an answer on June 1, 2026 at 6:43 am

    A COM server needs to be registered so that COM can find the DLL when a client program asks for it. Technically it can be avoided by giving the client program a manifest with reg-free COM entries, <clrClass> is required for COM servers that are written with managed code. Key point is that this manifest needs to be embedded in the client, not the server. Don’t go there yet until you’ve got your COM server working properly.

    One standard mistake is forgetting to use the /codebase option with Regasm.exe. Without it, the assembly needs to be strong-named and put in the GAC. This is not something you want to do on your dev machine. Another common mistake is using the wrong version of Regasm.exe. You’ll need to pay attention to the bitness on a 64-bit machine. And pick the right one if you use VS2010 and use the GAC, .NET 4 has a different location for the GAC.

    You ought to improve the attributes you use. A proper COM server only exposes the interfaces and hides the implementation. Use [InterfaceType(ComInterfaceType::InterfaceIsDual)] on the interface declaration and [ClassInterface(ClassInterfaceType::None)] on the class. You now also no longer need [ComDefaultInterface] and the type library dependency on mscorlib.tlb will be gone.

    If you still have trouble then SysInternals’ ProcMon utility can show you exactly where in the registry the client looked for your server and compare it against the actual registry locations that your server uses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have declared a class X in X.h as follows: namespace Foo { class
I have declared a class as class DCFrameListener : public FrameListener, public OIS::MouseListener, public
Here's interface that I have declared: [ServiceContract] public interface class IShedluer { [OperationContract] array<Object^>^
I have a class in C++/CLI that I'd like to give a property. I
I am having problems creating a managed class with namespace in C++/CLI. I would
I have declared a static method in class category public static function getPrefixFromSubCategoyId($subCategoryId) {
I have declared a class variable in here void downloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) {
I have declared a private field and a public property for a given class.
Suppose i have declared subscript operators in a class char& operator[] (int index); const
I have declared an enum in my server code, and would like my client

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.