1

Below, the method i' ve created is working for registering. But i get: "regasm : warning ra0000 : no types were unregistered" for unregistering.

    private static void ExecuteRegAsm(string comObjectPath, string typeLibraryName, string regAsmPathToExecute, string regAsmParameter = null)
    {
        var startInfo = new ProcessStartInfo
        {
            CreateNoWindow = false,
            UseShellExecute = false,
            FileName = regAsmPathToExecute,
            WindowStyle = ProcessWindowStyle.Hidden
        };

        switch (regAsmParameter)
        {
            case  null:
                startInfo.Arguments = comObjectPath + " /tlb:" + typeLibraryName + " /Codebase";
                break;
            case "/u":
            case "-u":
                startInfo.Arguments = "/u " + comObjectPath;
                break;
        }

        using (var exeProcess = Process.Start(startInfo))
        {
            if (exeProcess != null) exeProcess.WaitForExit();
        }
    }

How to solve this issue?

Seyda Güney
  • 55
  • 1
  • 10
  • I' ve created a custom COM Object for testing purpose only. And yes it has a class within. (with a default ctor.) and 2 interfaces with no functionality as well as the class. – Seyda Güney Feb 12 '14 at 09:28
  • Check this http://stackoverflow.com/questions/8054039/regasm-ra0000-no-types-were-registered – Sameer Feb 12 '14 at 09:33
  • I' ve already checked many similar posts about similar issues. That post made no sense by the way. My issue is different than that. But thank you for your care. – Seyda Güney Feb 12 '14 at 09:47
  • 1
    I' ve solved this issue. I' ve added /tlb: attribute and the type library name of the object as value to the code. So, for the case of "/u" and "-u" in the Switch Statement, the code is: startInfo.Arguments = comObjectPath + " /tlb:" + typeLibraryName + " /u"; – Seyda Güney Feb 12 '14 at 14:42

1 Answers1

3

I' ve solved this issue by adding /tlb: attribute and the type library name of the object as value to the code. Below method is working:

    private static void ExecuteRegAsm(string comObjectPath, string typeLibraryName, string regAsmPathToExecute, string regAsmParameter = null)
    {
        var startInfo = new ProcessStartInfo
        {
            CreateNoWindow = false,
            UseShellExecute = false,
            FileName = regAsmPathToExecute,
            WindowStyle = ProcessWindowStyle.Hidden
        };

        switch (regAsmParameter)
        {
            case  null:
                startInfo.Arguments = comObjectPath + " /tlb:" + typeLibraryName + " /Codebase";
                break;
            case "/u":
            case "-u":
                startInfo.Arguments = comObjectPath + " /tlb:" + typeLibraryName + " /u";
                break;
        }

        using (var exeProcess = Process.Start(startInfo))
        {
            if (exeProcess != null)
            {
                exeProcess.WaitForExit();
            }
        }
    }
Seyda Güney
  • 55
  • 1
  • 10