예제 #1
0
        /// <summary>
        ///     Compile the installer.
        /// </summary>
        /// <param name="installOptions">The install options.</param>
        private void CompileInstaller(InstallOptions installOptions)
        {
            // Ask to close and restart to update files with installer
            var _references = new List <string>
            {
                "System.dll",
                "System.Windows.Forms.dll"
            };

            ResourcesManager.CreateSettingsResource(installOptions.ResourceSettingsPath, installOptions);

            var _resources = new List <string>
            {
                installOptions.ResourceSettingsPath
            };

            var _sources = new[] { Resources.MainEntryPoint, Resources.ConsoleManager, Resources.Installer, Resources.ResourceSettings };

            string _updaterFileName = Application.StartupPath + @"\\Updater.exe";

            CompilerResults _results = CodeDomCompiler.Build(_references, _sources, _updaterFileName, _resources);

            if (_results.Errors.Count > 0)
            {
                VisualCompileErrorDialog.Show(_results);
            }
            else
            {
                Process.Start(_updaterFileName);
            }

            File.Delete(installOptions.ResourceSettingsPath);
        }