那是我的代码:
Process regAsmProcess = new Process();
ProcessStartInfo Process_Info = new ProcessStartInfo();
Process_Info.FileName = "C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Regasm.exe";
Process_Info.Arguments = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\myDLL.dll";
Process_Info.Verb = "runas";
regAsmProcess.StartInfo = Process_Info;
regAsmProcess.Start();
我还在运行此代码的项目中添加了一个 .manifest 文件并设置:
requestedExecutionLevel level="requireAdministrator"
这不是路径问题,要注册的dll与调用regAsm的程序在同一个文件夹中。它不起作用。有任何想法吗?