Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
来自C#代码的Regasm BHO_C#_Bho_Regasm - Fatal编程技术网

来自C#代码的Regasm BHO

来自C#代码的Regasm BHO,c#,bho,regasm,C#,Bho,Regasm,我有BHO IE插件的DLL 我使用“regasm.exe/codebase myBHO.dll”来注册我的dll windows应用程序中是否有任何C#代码可用于regasmmy DLL 为此创建专用安装程序 对于Visual Studio中的快速调试周期,请设置一些生成事件,如下所示: "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\gacutil.exe" /f /i $(Target

我有BHO IE插件的DLL

我使用“regasm.exe/codebase myBHO.dll”来注册我的dll


windows应用程序中是否有任何C#代码可用于regasmmy DLL

为此创建专用安装程序

对于Visual Studio中的快速调试周期,请设置一些生成事件,如下所示:

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\x64\gacutil.exe" /f /i $(TargetDir)$(TargetFileName) 
"%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" /unregister $(TargetDir)$(TargetFileName)
"%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" $(TargetDir)$(TargetFileName) /regfile:$(TargetFileName)64.reg
"%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe" /codebase $(TargetDir)$(TargetFileName)

"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\gacutil.exe" /f /i $(TargetDir)$(TargetFileName) 
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /unregister $(TargetDir)$(TargetFileName)
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" $(TargetDir)$(TargetFileName) /regfile:$(TargetFileName)32.reg
"%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe" /codebase $(TargetDir)$(TargetFileName)
然后,定义一个
[ComRegisterFunction]
如下:

[ComRegisterFunction]
public static void RegisterBHO(Type type)
{
    RegistryKey key;
    using (key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Browser Helper Objects"))
    {
      RegistryKey bhoKey;
      using (bhoKey = key.CreateSubKey(typeName))
      {
        bhoKey.SetValue(string.Empty, "My Awesone IE Plugin");
        bhoKey.SetValue("NoExplorer", 1, RegistryValueKind.DWord);
      }
    }      
}

这是安装人员的工作。例如,VS安装项目支持它。避免编写自己的安装程序。但如果您坚持,则可以使用RegistrationServices.RegisterAssembly()。请注意,UAC提升是必需的。谢谢,但我不知道如何在VS安装项目中做到这一点,当我将Dll的“Register”属性设置为“vsdraCOM”Not Work时,这对我很有帮助。我必须将key.CreateSubKey行更改为key.CreateSubKey(type.GUID.ToString(“B”))。