blob: fd36c2ca9241f7e3c738d90d557e49bc35ebc4e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolset.Tools
{
using System;
using System.Linq;
using WixToolset.Tools;
/// <summary>
/// Example executable that installs then immediately uninstalls a bundle showing progress.
/// </summary>
class Program
{
static int Main(string[] args)
{
if (args.Length == 0)
{
Console.WriteLine("Must provide the path to the bundle to install then uninstall.");
return -1;
}
BundleRunner runner = new BundleRunner(args[0]);
runner.Error += Program.OnError;
runner.Progress += Program.OnProgress;
Console.WriteLine("Installing: {0}", runner.Path);
int exitCode = runner.Run(String.Join(" ", args.Skip(1).ToArray()));
if (0 == exitCode)
{
Console.WriteLine("\r\nUninstalling: {0}", runner.Path);
exitCode = runner.Run("-uninstall");
}
return exitCode;
}
static void OnError(object sender, BundleErrorEventArgs e)
{
Console.WriteLine("error: {0}, uiHint: {1}, message: {2}", e.Code, e.UIHint, e.Message);
}
static void OnProgress(object sender, BundleProgressEventArgs e)
{
Console.WriteLine("progresss: {0}%", e.Progress);
}
}
}
|