I have a C# Class Library which I want to use as a COM object in VBScript. I'm using Visual Studio C# 2010 Express.

Here's the class code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace PB_GUID
    class PB_GUID_Encode
        private Guid _myGuid;
        private string _myHexGuid;
        private string _myBase64Guid;
        public Guid MyGuid
            get { return _myGuid; }
            set { _myGuid = value; }

        public string MyHexGuid
            get { return _myHexGuid; }
            set { _myHexGuid = value; }

        public string MyBase64Guid
            get { return _myBase64Guid; }
            set { _myBase64Guid = value; }

        // Constructor
        public PB_GUID_Encode()
            MyGuid = Guid.NewGuid();

            // HEX
            StringBuilder sb = new StringBuilder();
            foreach (byte b in MyGuid.ToByteArray())
                sb.Append(String.Format("{0:X2}", b));
            MyHexGuid = sb.ToString();

            // Base64
            MyBase64Guid = Convert.ToBase64String(MyGuid.ToByteArray());

When I build the Solution, I get the warning that the dll "does not contain any types that can be registered for COM Interop."

The Project is signed with a strong name, is set to "Make assembly COM-Visible", and I have "Register for COM interop" checked.

What more must I do to compile this as a COM object?

6 Years
Discussion Span
Last Post by tgreer

I fixed this... problem was using the public properties in the Constructor instead of the private fields.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.