アンインストーラー用に実行ファイル自体を削除するプログラムを開発しています。このサイトでもよく取り上げられるテーマだったので、なかなか道を見つけました。
答えの1つは-> http://www.codeproject.com/Articles/31454/How-To-Make-Your-Application-Delete-Itself-Immediaです。これを参考にして書きました。
string dir = Path.GetDirectoryName(Application.ExecutablePath);
ProcessStartInfo psi = new ProcessStartInfo();
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.FileName = "cmd";
psi.Arguments = "/C rmdir /s /q \"" + dir + "\"";
Process p = Process.Start(psi);
Application.Exit();
そのファイルの削除は成功しましたが、フォルダは削除されませんでした。それを含むフォルダも削除したいのですが、良い方法はありますか?