最近はnon-technicalな話題ばかりで申し訳ない・・・今日はTechnicalにいこう。


.NETで作成したWindows Serviceをインストールするには、CLRフォルダ以下にあるInstallUtil.exeを使用する。いちいちコマンドプロンプトからやるのが面倒だったのでWindows Explorerから右クリックでインストールできるようにレジストリをいじってみたらできた。


Windows Registry Editor Version 5.00


[HKEY_CLASSES_ROOT\exefile\shell\Install Windows Service 1.1]
@=”Install Windows Service 1.1″


[HKEY_CLASSES_ROOT\exefile\shell\Install Windows Service 1.1\command]
@=”\”C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\installutil.exe\” \”%1\”"


[HKEY_CLASSES_ROOT\exefile\shell\Install Windows Service 2.0]
@=”Install Windows Service 2.0″


[HKEY_CLASSES_ROOT\exefile\shell\Install Windows Service 2.0\command]
@=”\”C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\installutil.exe\” \”%1\”"


[HKEY_CLASSES_ROOT\exefile\shell\Uninstall Windows Service 1.1]
@=”Uninstall Windows Service 1.1″


[HKEY_CLASSES_ROOT\exefile\shell\Uninstall Windows Service 1.1\command]
@=”C:\\WINDOWS\\Microsoft.NET\\Framework\\v1.1.4322\\installutil.exe /u \”%1\”"


[HKEY_CLASSES_ROOT\exefile\shell\Uninstall Windows Service 2.0]
@=”Uninstall Windows Service 2.0″


[HKEY_CLASSES_ROOT\exefile\shell\Uninstall Windows Service 2.0\command]
@=”C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\installutil.exe /u \”%1\”"


これを.regファイルに保存して実行してやり、EXEファイルを右クリックすると・・・



こんな感じで簡単にInstallUtilが実行できてしまう。一応ググってみたがどうしてもこれが見つけられなかった・・・

コメント書き込み