예제 #1
0
    static void CheckCompatibility(SetupEventArgs e)
    {
        if (e.IsInstalling)
        {
            var conflictingProductCode = "{1D6432B4-E24D-405E-A4AB-D7E6D088C111}";

            if (AppSearch.IsProductInstalled(conflictingProductCode))
            {
                string msg = "Installed '{0}' is incompatible with this product.\n" +
                             "Setup will be aborted."
                             .FormatWith(AppSearch.GetProductName(conflictingProductCode) ?? conflictingProductCode);

                MessageBox.Show(msg, "Setup");
                e.Result = ActionResult.UserExit;
            }
        }
    }
예제 #2
0
파일: setup.cs 프로젝트: alxcp/wixsharp
    static void CheckCompatibility(SetupEventArgs e)
    {
        //MessageBox.Show("Hello World! (CLR: v" + Environment.Version + ")", "Embedded Managed UI (" + ((IntPtr.Size == 8) ? "x64" : "x86") + ")");

        if (e.IsInstalling)
        {
            var conflictingProductCode = "{1D6432B4-E24D-405E-A4AB-D7E6D088C111}";

            if (AppSearch.IsProductInstalled(conflictingProductCode))
            {
                string msg = string.Format("Installed '{0}' is incompatible with this product.\n" +
                                           "Setup will be aborted.",
                                           AppSearch.GetProductName(conflictingProductCode) ?? conflictingProductCode);
                MessageBox.Show(msg, "Setup");
                e.Result = ActionResult.UserExit;
            }
        }
    }
예제 #3
0
        [Fact] //xUnit/VSTest runtime doesn't play nice with MSI interop when debugging
        public void AppSearchTest()
        {
            var keyExist     = AppSearch.RegKeyExists(Registry.LocalMachine, @"System\CurrentControlSet\services");
            var fakeKeyExist = AppSearch.RegKeyExists(Registry.LocalMachine, "TTTT");
            var regValue     = AppSearch.GetRegValue(Registry.ClassesRoot, ".txt", null);
            var code         = AppSearch.GetProductCode("Windows Live Photo Common");
            var name         = AppSearch.GetProductName("{1D6432B4-E24D-405E-A4AB-D7E6D088CBC9}");
            var installed    = AppSearch.IsProductInstalled("{1D6432B4-E24D-405E-A4AB-D7E6D088CBC9}");
            var products     = AppSearch.GetProducts();

            Assert.True(keyExist);
            Assert.False(fakeKeyExist);
            Assert.Equal("txtfile", regValue);
            Assert.Equal("{1D6432B4-E24D-405E-A4AB-D7E6D088CBC9}", code.FirstOrDefault());
            Assert.Equal("Windows Live Photo Common", name);
            Assert.True(installed); //may fail on some machines
            Assert.True(products.Any());
        }