Esempio n. 1
0
 private static void RunInstaller(Action <Installer> installerAction)
 {
     using (var ti = new TransactedInstaller())
         using (var mi = new TfsDeployerInstaller())
         {
             ti.Installers.Add(mi);
             var path = String.Format("/assemblypath={0}", Assembly.GetExecutingAssembly().Location);
             var ctx  = new InstallContext("", new[] { path });
             ti.Context = ctx;
             installerAction(ti);
         }
 }
Esempio n. 2
0
        private static void InstallAssemblyInTransaction(Action <Installer> installerAction, IEnumerable <string> commandLine)
        {
            using (var installer = new TfsDeployerInstaller())
                using (var ti = new TransactedInstaller())
                {
                    var assemblyPath = String.Format("/assemblypath={0}", installer.GetType().Assembly.Location);
                    var commandLineWithAssemblyPath = (new[] { assemblyPath }).Concat(commandLine).ToArray();
                    var context = new InstallContext(null, commandLineWithAssemblyPath);

                    ti.Installers.Add(installer);
                    ti.Context = context;
                    installerAction(ti);
                }
        }
Esempio n. 3
0
        private static void Uninstall()
        {
            TransactedInstaller  ti = new TransactedInstaller();
            TfsDeployerInstaller mi = new TfsDeployerInstaller();

            ti.Installers.Add(mi);
            String path = String.Format("/assemblypath={0}",
                                        System.Reflection.Assembly.GetExecutingAssembly().Location);

            String[]       cmdline = { path };
            InstallContext ctx     = new InstallContext("", cmdline);

            ti.Context = ctx;
            ti.Uninstall(null);
        }
Esempio n. 4
0
        public static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += DomainUnhandledException;

            var mode = DeployerContainerBuilder.RunMode.InteractiveConsole;

            if (args.Length > 0)
            {
                if (args[0].StartsWith("-i", StringComparison.InvariantCultureIgnoreCase) || args[0].StartsWith("/i", StringComparison.InvariantCultureIgnoreCase))
                {
                    var remainingArgs = args.Skip(1).ToArray();
                    TfsDeployerInstaller.Install(remainingArgs);
                    return;
                }
                if (args[0] == "-u")
                {
                    TfsDeployerInstaller.Uninstall();
                    return;
                }
                if (args[0].StartsWith("-s", StringComparison.InvariantCultureIgnoreCase))
                {
                    mode = DeployerContainerBuilder.RunMode.WindowsService;
                }
            }

            if (!Environment.UserInteractive)
            {
                mode = DeployerContainerBuilder.RunMode.WindowsService;
            }

            var containerBuilder = new DeployerContainerBuilder(mode);

            _container = containerBuilder.Build();

            Trace.Listeners.Add(_container.Resolve <TraceListener>());
            _container.Resolve <IProgramEntryPoint>().Run();
        }
Esempio n. 5
0
 private static void Uninstall()
 {
     TransactedInstaller ti = new TransactedInstaller();
     TfsDeployerInstaller mi = new TfsDeployerInstaller();
     ti.Installers.Add(mi);
     String path = String.Format("/assemblypath={0}",
     System.Reflection.Assembly.GetExecutingAssembly().Location);
     String[] cmdline = { path };
     InstallContext ctx = new InstallContext("", cmdline);
     ti.Context = ctx;
     ti.Uninstall(null);
 }