在.Net中怎么做卸载删除程序啊?只要是在Windows平台运行就可以。最好方法不要太复杂。知道的帮帮忙,谢谢了。

解决方案 »

  1.   

    msiexec.exe /x ProductID /qb+;
      

  2.   

    建1个WindowsApplicationusing System;
    using System.Windows.Forms;
    using System.Diagnostics;namespace Uninstall
    {
    /// <summary>
    /// MainClass 的摘要说明。
    /// </summary>
    public class MainClass
    {
    public MainClass()
    {
    //
    // TODO: 在此处添加构造函数逻辑
    //
    }
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    if(System.Environment.OSVersion.ToString().IndexOf("NT 5") >= 0)
    {
    Process.Start("msiexec","/uninstall {BDA4996C-6895-4F4C-839C-9AFE22FB8545}");
    }
    Application.Exit();
    }
    }
    }----------------
    其中的代码应该明白吧,把{BDA4996C-6895-4F4C-839C-9AFE22FB8545}换成你打包的UID就行了
      

  3.   

    你如果用.net自带的程序打包的话,我这里有一个小例子
      

  4.   

    回BearRui(孤熊 | 带你去看海!):非常感谢。我怎么没想到,太笨了。回lostowner():我是用.net自带的程序打包的。你的方法是怎么做的?希望能讲一下。多多益善嘛。
      

  5.   

    回lostowner():我是用.net自带的程序打包的。
    期待中......
      

  6.   

    建立文件uninstall.bat 把下面的代码写进去就行了 
    msiexec.exe /x ProductID /qb+;
      

  7.   

    回lidong6(立冬):这个方法确实简单,但是能不能不让控制台窗口出现?
      

  8.   

    关于卸载程序我还有几个文件不是使用install文件安装进去的,
    卸载的时候我也要删除掉它们但是有些时候我点了卸载,
    我又决定不卸载它了,点“Cancel”static void Main() 
    {
    if(System.Environment.OSVersion.ToString().IndexOf("NT 5") >= 0)
    {
    Process.Start("msiexec","/uninstall {BDA4996C-6895-4F4C-839C-9AFE22FB8545}");//这里我就是想得到我按cancel的返回值
    如果没按cancel
    if(File.Exists(fiel1))
    {
    File.Delete(file);
    }
    否则
    不删除文件
    }
    Application.Exit();
    }怎么做啊
    ???
      

  9.   

    //这里我就是想得到我按cancel的返回值可以在此显示窗口或MessageBox让用户确定,没试过,但应该可以
      

  10.   

    右键msiexec.exe 
    创建快捷方式
      

  11.   

    有人研究过windows install xml吗?
    如有
    msn联系:marian——[email protected]
      

  12.   

    Wind_Sword(风刀霜剑):
    你自己写一个隐藏的窗体,在里面执行这个进程也可以.
      

  13.   

    有人研究过windows install xml吗?
    如有
    msn联系:marian——[email protected]小弟我有个问题要请教大虾!