示例#1
0
    static public void Main()
    {
        //just a sample
        string msiFile = @"..\Projects\WixSharp\Main\WixSharp.Samples\Wix# Samples\_CustomDialog\External_CLR_GUI\MsiInterop\MyProduct.msi";

        string msiParams = "";    //install

        msiParams = "REMOVE=ALL"; //uninstall

        var  msi         = new MsiParser(msiFile);
        var  productCode = msi.GetProductCode();
        bool installed   = msi.IsInstalled();

        //IntPtr product;
        //MsiExtensions.Invoke(() => MsiInterop.MsiOpenProduct(productCode, out product));

        Console.WriteLine("The product is {0}INSTALLED\n\n", installed ? "" : "NOT ");
        if (installed)
        {
            msiParams = "REMOVE=ALL"; //uninstall
        }
        else
        {
            msiParams = ""; //install
        }
        var session = new MsiSession();

        session.Execute(msiFile, msiParams);
    }
示例#2
0
        void UpdateStatus()
        {
            var msi = new MsiParser(msiFile);

            IsCurrentlyInstalled = msi.IsInstalled();
            ProductName          = msi.GetProductName();
            ProductVersion       = msi.GetProductVersion();

            ProductStatus = string.Format("The product is {0}INSTALLED\n\n", IsCurrentlyInstalled ? "" : "NOT ");
        }