-
Notifications
You must be signed in to change notification settings - Fork 146
/
NgenInstaller.cs
34 lines (33 loc) · 946 Bytes
/
NgenInstaller.cs
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
using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
namespace NMaier.SimpleDlna
{
[RunInstaller(true)]
public class NgenInstaller : Installer
{
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
using (var proc = new Process()) {
proc.StartInfo.FileName = Path.Combine(
RuntimeEnvironment.GetRuntimeDirectory(),
"ngen.exe"
);
proc.StartInfo.Arguments = $"install /nologo \"{Assembly.GetExecutingAssembly().Location}\"";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
if (proc.ExitCode != 0) {
throw new Exception("Failed to run ngen");
}
}
}
}
}