Exemplo n.º 1
0
 private void DeployIlMerge()
 {
     if (!File.Exists(Res.GetResourceFile(ResourceFamily.Builder, "ILMerge.exe")))
     {
         File.WriteAllBytes(Res.GetResourceFile(ResourceFamily.Builder, "ILMerge.exe"), Properties.Resources.ILMerge);
     }
 }
Exemplo n.º 2
0
        private void PerformDependencyMerge(string filename)
        {
            var proc = new Process();

            proc.StartInfo.FileName  = Res.GetResourceFile(ResourceFamily.Builder, "ILMerge.exe");
            proc.StartInfo.Arguments = string.Format(@"/log /out:""{0}"" ""{1}"" ""{2}""", filename,
                                                     Res.GetResourceFile(ResourceFamily.Builder, "temp.exe"),
                                                     Res.GetResourceFile(ResourceFamily.Builder, "uNet2.dll"));
            proc.StartInfo.UseShellExecute        = false;
            proc.StartInfo.CreateNoWindow         = true;
            proc.StartInfo.RedirectStandardOutput = true;
            proc.Start();
            proc.WaitForExit();
        }
Exemplo n.º 3
0
        public void Build(string filename)
        {
            if (!File.Exists(ResourcesHelper.GetResourceFile(ResourceFamily.Builder, "stub.exe")))
            {
                throw new ComponentMissingException("Failed to locate stub file");
            }
            var asm = AssemblyDef.Load(Res.GetResourceFile(ResourceFamily.Builder, "stub.exe"));

            InjectSettings(asm);
            if (_settings.MergeDependencies)
            {
                asm.Write(Res.GetResourceFile(ResourceFamily.Builder, "temp.exe"));
                DeployIlMerge();
                PerformDependencyMerge(filename);
            }
            else
            {
                asm.Write(filename);
                File.Copy(Res.GetResourceFile(ResourceFamily.Builder, "uNet2.dll"),
                          Path.Combine(Path.GetDirectoryName(filename), "uNet2.dll"));
            }
        }