RegAsm Unregister Issue

后端 未结 1 726
醉酒成梦
醉酒成梦 2021-01-27 05:10

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

    private s         


        
相关标签:
1条回答
  • 2021-01-27 05:35

    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();
                }
            }
        }
    
    0 讨论(0)
提交回复
热议问题