运行时删除自己

Bla*_*oid 3 c# uninstallation c#-4.0

我正在创建一个删除应用程序文件夹的卸载应用程序.问题是我无法删除同一文件夹中的卸载程序应用程序导致其运行.有没有办法在运行时删除应用程序,所以它只是在内存中.

        string Installation = UninstallRegister.Read("InstallationLocation");
        if (Directory.Exists(StartMenu))
        {
            Directory.Delete(StartMenu, true);
        }
Run Code Online (Sandbox Code Playgroud)

最好的祝福

Vla*_*lad 5

一个简单的想法是将卸载应用程序复制到%TEMP%并从那里运行.然而,这将留下%TEMP%的文件(任何人都可能不会注意到).