Пример #1
0
        private static ManagedProject CreateProject()
        {
            var binaryCode = new Feature("binary's", "My application binary's. This is mandatory of-course.", true, false);
            var registerDllInAutoCAD2019 = new Feature("Register AutoCAD 2019 dll.", "Check this if you want to register the dll to automatically load upon the launching of AutoCAD.", true, true);
            var registerDllInC3D2019     = new Feature("Register dll in C3D 2019.", "Check this if you want to register the dll to automatically load upon the launching of AutoCAD C3D.", true, true);

            // <Guid("1EB1D6F2-8704-4D6F-9BDE-83D07308D14F")>
            var project =
                new ManagedProject(productName,
                                   new InstallDir(binaryCode, productTargetInstallPath,
                                                  new WixSharp.File(@"readme.txt"),
                                                  new WixSharp.File(@"license.rtf"),
                                                  new Files(@"release\*.*"),
                                                  new File(new Id("ATL"), @"trustedlocations\AutocadTrustedLocations.exe"),
                                                  new File(@"trustedlocations\CommandLineArgumentsParser.dll"),
                                                  new File(@"trustedlocations\AutocadTrustedLocations.exe.config")
                                                  )
                                   )

                // Object initializer:
            {
                Name              = productName,
                OutFileName       = $"infrabel.topohelper.{Version}",
                Description       = productDescription,
                GUID              = new Guid(productGUID),
                Version           = Version,
                ControlPanelInfo  = CreateProductInfo(),
                InstallPrivileges = InstallPrivileges.limited,
                InstallScope      = InstallScope.perUser,
                SourceBaseDir     = sourcePathOfFiles,
                ReinstallMode     = "amus",
                LicenceFile       = @"license.rtf"
            };

            project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
            project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize;
            project.PreserveTempFiles = false;
            project.UI = WUI.WixUI_Common;
            project.SetNetFxPrerequisite(Condition.Net46_Installed, ErrorMessageDotNet);
            project.AfterInstall  += Project_AfterInstall;
            project.BeforeInstall += Project_BeforeInstall;
            project.OutDir         = installerFolderPath;

            // Register application with autoCAD
            project.AddRegValues(
                //? AutoCAD 2019
                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "LOADCTRLS", 14)
            {
                AttributesDefinition = typeInt
            },
                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "LOADER", dllFinalPath),
                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "MANAGED", 1)
            {
                AttributesDefinition = typeInt
            },

                new RegValue(registerDllInAutoCAD2019, RegistryHive.LocalMachineOrUsers, KeyACAD19, "DESCRIPTION", productDescription),

                //? AutoCAD C3D 2019
                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "LOADCTRLS", 14)
            {
                AttributesDefinition = typeInt
            },

                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "LOADER", dllFinalPath),

                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "MANAGED", 1)
            {
                AttributesDefinition = typeInt
            },

                new RegValue(registerDllInC3D2019, RegistryHive.LocalMachineOrUsers, KeyC3D19, "DESCRIPTION", productDescription));

            return(project);
        }