C # program to install software packages How to join Uninstaller

With VS2019, how to join the uninstaller package installation package, go to Control Panel each time to find, very efficient ah
software update every time, you want to go to the Control Panel, uninstall, find the icon, and then unloaded. Very slow
because it is a novice, please be patient a little, one more point in detail, such as where to add, what to add? Where to find, thank you

There is one option, I was alone write their own uninstall program.
Because after a package.
I notice the drag event and another event conflict (UAC permissions cause of this. Anyway, for now it seems no solution, the windows of the bug.)

I wrote the uninstall program, and then create a shortcut to the uninstaller in the Start menu, the following code can be directly Copy
  [the ComImport]
        [Guid ( "00021401-0000-0000-C000-000000000046")]
        Internal class ShellLink
        {
        }
        [the ComImport]
        [the InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
        [the Guid ( "000214F9-0000-0000-C000-000000000046")]
        Internal interface the IShellLink
        {
            void the GetPath ([Out, the MarshalAs (UnmanagedType.LPWStr)] the StringBuilder pszFile, int cchMaxPath, PFD IntPtr OUT, the fFlags int);
            void GetIDList (IntPtr ppidl OUT);
            void SetIDList (IntPtr PIDL);
            void GetDescription([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszName, int cchMaxName);
            void SetDescription([MarshalAs(UnmanagedType.LPWStr)] string pszName);
            void GetWorkingDirectory([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszDir, int cchMaxPath);
            void SetWorkingDirectory([MarshalAs(UnmanagedType.LPWStr)] string pszDir);
            void GetArguments([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszArgs, int cchMaxPath);
            void SetArguments([MarshalAs(UnmanagedType.LPWStr)] string pszArgs);
            void GetHotkey(out short pwHotkey);
            void SetHotkey(short wHotkey);
            void GetShowCmd(out int piShowCmd);
            void SetShowCmd(int iShowCmd);
            void GetIconLocation([Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszIconPath, int cchIconPath, out int piIcon);
            void SetIconLocation([MarshalAs(UnmanagedType.LPWStr)] string pszIconPath, int iIcon);
            void SetRelativePath([MarshalAs(UnmanagedType.LPWStr)] string pszPathRel, int dwReserved);
            void Resolve(IntPtr hwnd, int fFlags);
            void SetPath([MarshalAs(UnmanagedType.LPWStr)] string pszFile);
        }

 private void CreatShortcut()
{
          IShellLink link = (IShellLink)new ShellLink();
            link.SetDescription("程序描述");
            link.SetPath(卸载程序路径); //指定文件路径

            IPersistFile file = (IPersistFile)link;
           string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.StartMenu);
            string sfile = Path.Combine(desktopPath, "卸载XXXXX程序.lnk");
            if (File.Exists(sfile))
                File.Delete(sfile);
            file.Save(sfile, false);
}

According to a post before I added the windows in a file on my computer can be uninstalled, but packaged to others Bee Forum Replies machine after the others will not be able to uninstall

The question I can answer you, msiexec.exe copy you make under systme32 to the installation directory, give others put something on okay.

Published 26 original articles · won praise 0 · Views 1029

Guess you like

Origin blog.csdn.net/netyou/article/details/104291946