C# Cannot register assembly when building Class to make a COM Object (Visual Studio 2013)

justaphase used Ask the Experts™
I Experts,

I'm trying to learn how to do ActiveX components (COM Interop) in C# so i can use them in Visual FoxPro (Old applications that are still running).
I'm using Visual Studio 2013.

I tried this example: http://stackoverflow.com/questions/3360160/how-do-i-create-an-activex-com-in-c

But when i build the project i get this error:
Cannot register assembly "d:\documents\visual studio 2013\Projects\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll" - access denied. Please make sure you're running the application as administrator. Access to the registry key 'HKEY_CLASSES_ROOT\Launcher.Launcher' is denied.      ClassLibrary1

What am i missing?

Also, if anyone know a good walk trough to learn how to create ActiveX (COM Objects) in Visual Studio 2013 would also be much appreciated :)

Thx in advanced,

My AssemblyInfo.cs file code:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright ©  2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("03dba714-4abf-4893-b2b5-b5f0d70fcc86")]

// Version information for an assembly consists of the following four values:
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("")]
[assembly: AssemblyFileVersion("")]
//[assembly: AssemblyKeyFile("Database_COM_Key.snk")]

Open in new window

My Class1.cs file code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Runtime.InteropServices;

namespace Launcher

    [InterfaceType(ComInterfaceType.InterfaceIsDual), Guid("1DE7CD26-92B0-441F-B3D3-7C55758DD8FE")]
    public interface ILauncher
        void launch();

    [ClassInterface(ClassInterfaceType.None), Guid("911DB332-D76D-499C-9200-704C1B85BEA7"), ProgId("Launcher.Launcher")]
    public class Launcher : ILauncher
        private string path = null;

        public void launch()
            Console.WriteLine("I launch scripts for a living.");


Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Architect, Technical Expert
It seems you do not have sufficient privileges to register the COM object in the registry.  This requires admin privileges.


Damn... i started the Visual Studio 2013 as Administrator and worked....
That's weird... that simple??
Franck GaspozSoftware Architect, Technical Expert

Access to the registry is effectively systematically restricted to administrators for security reasons. Anyway the error message was very explicit. Happy to have helped !

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial