2009-12-07 Rolf Bjarne Kvinge <RKvinge@novell.com>
[moon.git] / tools / mxap / mxap.cs
blobbed953c872277b1c3b10e343898fdb0b838b4456
2 using NDesk.Options;
3 using System;
4 using System.IO;
5 using System.Text;
6 using System.Diagnostics;
7 using System.Collections.Generic;
9 namespace Moonlight {
11 public class MXap {
13 private string application_name;
14 private List<string> external_assemblies;
15 private List<string> reference_assemblies;
16 private List<string> mdb_files;
17 private List<string> csharp_files;
18 private List<string> xaml_files;
19 private List<string> defines;
20 private Dictionary<string, string> resources;
21 private Dictionary<string, string> assembly_resources;
22 private Dictionary<string, string> content_resources;
23 private string top_builddir = null; // Defaults to null
24 private bool desktop = false; // Defaults to false
25 private bool generate_html = true; // Defaults to true
26 private bool include_mdb = true; // Defaults to true
27 private bool verbose = false; //default to false
28 private bool generate_manifest = true;
29 private bool list_generated = false;
30 private string entry_point_type = null;
31 private string cs_sources;
32 private string cd;
33 private bool in_place = true;
35 const string RuntimeVersion2 = "2.0.31005.0";
36 const string RuntimeVersion3 = "3.0.40624.0";
38 private string RuntimeVersion = RuntimeVersion2;
40 public string CSSources {
41 get { return cs_sources; }
42 set { cs_sources = value; }
45 public string EntryPointType {
46 get { return entry_point_type; }
47 set { entry_point_type = value; }
50 public bool GenerateManifest {
51 get { return generate_manifest; }
52 set { generate_manifest = value; }
55 public bool GenerateHtml {
56 get { return generate_html; }
57 set { generate_html = value; }
60 public bool Desktop {
61 get { return desktop; }
62 set { desktop = value; }
65 public string TopBuildDir {
66 get { return top_builddir; }
67 set { top_builddir = value; }
70 public bool IncludeMdb {
71 get { return include_mdb; }
72 set { include_mdb = value; }
75 public bool Verbose {
76 get { return verbose; }
77 set { verbose = value; }
80 public bool ListGenerated {
81 get { return list_generated; }
82 set { list_generated = value; }
85 public string Cd {
86 get { return cd; }
87 set { cd = value; }
90 public string ApplicationName {
91 get {
92 if (application_name == null) {
93 DirectoryInfo di = new DirectoryInfo (Directory.GetCurrentDirectory ());
94 application_name = di.Name;
95 application_name.Replace ("-", "_");
98 return application_name;
100 set {
101 application_name = value;
105 public List<string> ReferenceAssemblies {
106 get {
107 if (reference_assemblies == null)
108 reference_assemblies = new List<string> ();
109 return reference_assemblies;
113 public List<string> ExternalAssemblies {
114 get {
115 if (external_assemblies == null)
116 external_assemblies = new List<string> ();
117 return external_assemblies;
121 public List<string> MdbFiles {
122 get {
123 if (mdb_files == null)
124 mdb_files = new List<string> ();
125 return mdb_files;
129 public List<string> CSharpFiles {
130 get {
131 if (csharp_files == null)
132 csharp_files = new List<string> ();
133 return csharp_files;
137 public List<string> XamlFiles {
138 get {
139 if (xaml_files == null)
140 xaml_files = new List<string> ();
141 return xaml_files;
145 public List<string> Defines {
146 get {
147 if (defines == null)
148 defines = new List<string> ();
149 return defines;
153 public Dictionary<string, string> Resources {
154 get {
155 if (resources == null)
156 resources = new Dictionary<string, string> ();
157 return resources;
161 public Dictionary<string, string> AssemblyResources {
162 get {
163 if (assembly_resources == null)
164 assembly_resources = new Dictionary<string, string> ();
165 return assembly_resources;
169 public Dictionary<string, string> ContentResources {
170 get {
171 if (content_resources == null)
172 content_resources = new Dictionary<string, string> ();
173 return content_resources;
177 public string TmpDir { get; set; }
178 public string WorkingDir { get; set; }
179 public string OutputDir { get; set; }
180 public bool InPlace {
181 get { return in_place; }
182 set { in_place = value; }
185 public bool Run ()
187 return (CreateManifest ()
188 && CreateCodeBehind ()
189 && CreateResources ()
190 && CreateApplicationAssembly ()
191 && CreateXap ()
192 && CreateHtmlWrapper ());
195 public bool CreateManifest ()
197 string AppManifest_Filename = "AppManifest.xaml";
199 if (!GenerateManifest)
200 return true;
202 if (ListGenerated) {
203 Console.WriteLine (AppManifest_Filename);
204 return true;
207 StringBuilder manifest = new StringBuilder ();
209 manifest.Append ("<Deployment xmlns=\"http://schemas.microsoft.com/client/2007/deployment\"");
210 manifest.Append (" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" ");
211 manifest.AppendFormat ("EntryPointAssembly=\"{0}\" EntryPointType=\"", ApplicationName);
212 if (entry_point_type != null)
213 manifest.Append (entry_point_type);
214 else
215 manifest.AppendFormat ("{0}.App", ApplicationName);
216 manifest.AppendFormat ("\" RuntimeVersion=\"{0}\">\n", RuntimeVersion);
218 manifest.AppendLine (" <Deployment.Parts>");
220 foreach (string assembly in ReferenceAssemblies) {
221 manifest.AppendFormat (" <AssemblyPart x:Name=\"{0}\" Source=\"{1}\" />\n", Path.GetFileNameWithoutExtension (assembly), Path.GetFileName (assembly));
223 manifest.AppendFormat (" <AssemblyPart x:Name=\"{0}\" Source=\"{1}.dll\" />\n", ApplicationName, ApplicationName);
225 manifest.AppendLine (" </Deployment.Parts>");
226 manifest.AppendLine ("</Deployment>");
228 File.WriteAllText (AppManifest_Filename, manifest.ToString ());
230 return true;
233 public bool CreateCodeBehind ()
235 if (ListGenerated) {
236 foreach (string xaml_file in XamlFiles) {
237 if (Path.GetFileName (xaml_file) == "AppManifest.xaml")
238 continue;
239 Console.WriteLine ("{0}.g.cs", Path.GetFileName (xaml_file));
241 return true;
243 else {
244 StringBuilder xamlg_args = new StringBuilder ();
246 xamlg_args.AppendFormat (" -sl2app:{0} ", ApplicationName);
247 xamlg_args.AppendFormat (" -root:{0} ", WorkingDir);
249 foreach (string xaml_file in XamlFiles) {
250 if (Path.GetFileName (xaml_file) == "AppManifest.xaml")
251 continue;
252 //xamlg_args.AppendFormat (" {0}", Path.GetFileName (xaml_file));
253 xamlg_args.AppendFormat (" \"{0}\"", xaml_file);
256 return RunTool ("xamlg",
257 "tools/xamlg/xamlg.exe",
258 xamlg_args.ToString ());
262 public bool CreateResources ()
264 if (ListGenerated) {
265 Console.WriteLine ("{0}.g.resources", ApplicationName);
266 return true;
269 StringBuilder respack_args = new StringBuilder ();
271 respack_args.AppendFormat ("{0}.g.resources ", ApplicationName);
273 foreach (string xaml_file in XamlFiles) {
274 if (Path.GetFileName (xaml_file) == "AppManifest.xaml")
275 continue;
276 //respack_args.AppendFormat (" {0}", Path.GetFileName (xaml_file));
277 respack_args.AppendFormat (" \"{0}\"", xaml_file);
280 foreach (KeyValuePair<string, string> pair in Resources)
281 respack_args.AppendFormat (" \"{0},{1}\"", pair.Value, pair.Key);
283 return RunTool ("respack",
284 "tools/respack/respack.exe",
285 respack_args.ToString ());
288 public bool CreateApplicationAssembly ()
290 if (ListGenerated) {
291 Console.WriteLine ("{0}.dll", ApplicationName);
292 return true;
295 StringBuilder compiler_args = new StringBuilder ();
297 if (desktop)
298 compiler_args.Append (" -d:DESKTOP ");
299 foreach (string define in Defines) {
300 compiler_args.AppendFormat (" -d:{0} ", define);
303 compiler_args.AppendFormat (" -debug+ -target:library -out:{0}.dll ", ApplicationName);
305 foreach (string asm in ReferenceAssemblies) {
306 compiler_args.AppendFormat (" -r:\"{0}\" ", asm);
309 foreach (string asm in ExternalAssemblies) {
310 compiler_args.AppendFormat (" -r:{0} ", asm);
313 if (desktop && top_builddir == null) {
314 compiler_args.Append (" -pkg:moonlight-gtk");
317 foreach (string cs in CSharpFiles) {
318 if (cs.EndsWith (".g.cs"))
319 continue;
320 compiler_args.AppendFormat (" \"{0}\" ", cs);
323 foreach (string xaml in XamlFiles) {
324 if (Path.GetFileName (xaml) == "AppManifest.xaml")
325 continue;
326 if (!File.Exists (Path.GetFileName (xaml) + ".g.cs"))
327 continue;
328 compiler_args.AppendFormat (" {0}.g.cs ", Path.GetFileName (xaml));
331 compiler_args.AppendFormat (" -resource:{0}.g.resources ", ApplicationName);
333 foreach (KeyValuePair<string, string> pair in AssemblyResources)
334 compiler_args.AppendFormat (" -resource:\"{0},{1}\"", pair.Value, pair.Key);
336 if (desktop)
337 return RunProcess ("gmcs", compiler_args.ToString());
338 else
339 return Run21Tool ("smcs",
340 "class/lib/2.1/smcs.exe",
341 compiler_args.ToString());
344 public bool CreateXap ()
346 if (ListGenerated) {
347 Console.WriteLine ("{0}.xap", ApplicationName);
348 return true;
351 StringBuilder zip_args = new StringBuilder ();
352 zip_args.AppendFormat (" {0}.xap ", ApplicationName);
354 foreach (string asm in ReferenceAssemblies) {
355 zip_args.AppendFormat (" {0} ", Path.GetFileName (asm));
357 foreach (string mdb in MdbFiles) {
358 zip_args.AppendFormat (" {0} ", Path.GetFileName (mdb));
361 zip_args.AppendFormat (" AppManifest.xaml ");
362 zip_args.AppendFormat (" {0}.dll ", ApplicationName);
363 zip_args.AppendFormat (" {0}.dll.mdb ", ApplicationName);
365 foreach (KeyValuePair<string, string> pair in ContentResources)
366 zip_args.AppendFormat (" " + pair.Value);
368 return RunProcess ("zip", zip_args.ToString ());
371 public bool CreateHtmlWrapper ()
373 if (!GenerateHtml)
374 return true;
376 if (ListGenerated) {
377 Console.WriteLine ("{0}.html", ApplicationName);
378 return true;
381 StringBuilder xaml2html_args = new StringBuilder ();
383 xaml2html_args.AppendFormat (" {0}.xap ", ApplicationName);
385 return RunTool ("xaml2html",
386 "tools/xaml2html/xaml2html.exe",
387 xaml2html_args.ToString ());
390 private bool Run21Tool (string filename, string builddir_exe, string args)
392 string old_mono_path = Environment.GetEnvironmentVariable ("MONO_PATH");
393 if (TopBuildDir != null) {
394 string new_mono_path = Path.Combine (
395 Path.Combine (
396 Path.Combine (TopBuildDir, "class"),
397 "lib"),
398 "2.1");
399 if (!string.IsNullOrEmpty (old_mono_path))
400 new_mono_path = string.Format ("{0}:{1}", new_mono_path, old_mono_path);
401 Environment.SetEnvironmentVariable ("MONO_PATH", new_mono_path);
404 bool rv = RunTool (filename, builddir_exe, args);
406 if (TopBuildDir != null)
407 Environment.SetEnvironmentVariable ("MONO_PATH", old_mono_path);
409 return rv;
413 private bool RunTool (string filename, string builddir_exe, string args)
415 if (top_builddir != null) {
416 bool need_smcs_hack = false;
417 if (filename == "smcs")
418 need_smcs_hack = true;
419 filename = "mono";
420 args = String.Format ("{3}{0}/{1} {2}", top_builddir, builddir_exe, args,
421 need_smcs_hack ? "--runtime=moonlight --security=temporary-smcs-hack " : "");
424 return RunProcess (filename, args);
427 private bool RunProcess (string filename, string args)
429 if (Verbose)
430 Console.WriteLine ("Running {0} {1}", filename, args);
432 Process process = new Process ();
434 process.StartInfo.FileName = filename;
435 process.StartInfo.Arguments = args;
437 process.StartInfo.CreateNoWindow = true;
438 process.StartInfo.UseShellExecute = false;
440 process.Start ();
442 process.WaitForExit ();
444 return (process.ExitCode == 0);
447 static void ShowHelp (OptionSet os)
449 Console.WriteLine ("mxap usage is: mxap [options] [directory]");
450 Console.WriteLine ();
451 os.WriteOptionDescriptions (Console.Out);
454 void AddResource (string v)
456 if (string.IsNullOrEmpty (v))
457 return;
459 string name, filename;
460 bool local = Path.GetFullPath (v).StartsWith (Path.GetFullPath ("."));
461 int comma = v.IndexOf (',');
462 if (comma == -1) {
463 if (local) {
464 name = v;
465 filename = v;
466 } else {
467 name = filename = Path.GetFileName (v);
468 if (!InPlace)
469 File.Copy (v, Path.Combine (TmpDir, Path.GetFileName (v)));
470 else
471 File.Copy (v, Path.Combine (WorkingDir, Path.GetFileName (v)));
473 } else {
474 name = v.Substring (comma + 1);
475 filename = v.Substring (0, comma);
476 if (!InPlace) {
477 File.Copy (filename, Path.Combine (TmpDir, Path.GetFileName (filename)));
478 filename = Path.Combine (TmpDir, Path.GetFileName (filename));
482 Resources.Add (name, filename);
485 void AddAssemblyResource (string v)
487 if (string.IsNullOrEmpty (v))
488 return;
490 string name, filename;
492 bool local = Path.GetFullPath (v).StartsWith (Path.GetFullPath ("."));
493 int comma = v.IndexOf (',');
494 if (comma == -1) {
495 if (local) {
496 name = ApplicationName + "." + v.Replace ('/', '.');
497 filename = v;
498 } else {
499 name = ApplicationName + "." + Path.GetFileName (v);
500 filename = Path.GetFileName (v);
501 if (!InPlace)
502 File.Copy (v, Path.Combine (TmpDir, filename));
503 else
504 File.Copy (v, Path.Combine (WorkingDir, filename));
506 } else {
507 name = v.Substring (comma + 1);
508 filename = v.Substring (0, comma);
509 if (!InPlace) {
510 File.Copy (filename, Path.Combine (TmpDir, Path.GetFileName (filename)));
511 filename = Path.Combine (TmpDir, Path.GetFileName (filename));
515 AssemblyResources.Add (name, filename);
518 void AddContentResource (string v)
520 if (string.IsNullOrEmpty (v))
521 return;
523 string name, filename;
524 bool local = Path.GetFullPath (v).StartsWith (Path.GetFullPath ("."));
525 int comma = v.IndexOf (',');
526 if (comma == -1) {
527 if (local) {
528 name = v;
529 filename = v;
530 } else {
531 name = filename = Path.GetFileName (v);
532 if (!InPlace)
533 File.Copy (v, Path.Combine (TmpDir, Path.GetFileName (v)));
534 else
535 File.Copy (v, Path.Combine (WorkingDir, Path.GetFileName (v)));
537 } else {
538 name = v.Substring (comma + 1);
539 filename = v.Substring (0, comma);
540 if (!InPlace) {
541 File.Copy (filename, Path.Combine (TmpDir, Path.GetFileName (filename)));
542 filename = Path.Combine (TmpDir, Path.GetFileName (filename));
546 ContentResources.Add (name, filename);
549 void SetRuntimeVersion (string v)
551 switch (v) {
552 case "2":
553 RuntimeVersion = RuntimeVersion2;
554 break;
555 case "3":
556 RuntimeVersion = RuntimeVersion3;
557 break;
558 default:
559 RuntimeVersion = v;
560 break;
564 static void DoClean (string app)
566 File.Delete (app + ".dll");
567 File.Delete (app + ".dll.mdb");
568 File.Delete (app + ".g.resources");
569 File.Delete (app + ".html");
570 File.Delete (app + ".xap");
571 File.Delete ("AppManifest.xaml");
572 foreach (string path in Directory.GetFiles (Directory.GetCurrentDirectory(), "*.g.cs"))
573 File.Delete(path);
576 static void RecursiveCopy (string source, string dir, string dest)
578 foreach (string file in Directory.GetFiles (source + dir))
579 File.Copy (file, Path.Combine (dest + dir, Path.GetFileName (file)));
580 foreach (string d in Directory.GetDirectories (source + dir)) {
581 string d1 = d.Replace (source, "");
582 Directory.CreateDirectory (dest + d1);
583 RecursiveCopy (source, d1, dest);
588 static bool ParseBool (string v, bool defaul) {
589 if (v == null) return true;
590 bool ret;
591 if (bool.TryParse (v, out ret))
592 return ret;
593 if (v.ToLower() == "no") return false;
594 if (v.ToLower() == "yes") return true;
595 return defaul;
598 public static int Main (string [] args)
600 MXap mxap = new MXap ();
601 bool help = false;
602 bool clean = false;
603 List<string> resources = new List<string>();
604 List<string> aresources = new List<string>();
605 List<string> cresources = new List<string>();
606 string resourceFile = null;
607 string aresourceFile = null;
608 string cresourceFile = null;
610 mxap.Cd = Directory.GetCurrentDirectory ();
612 var p = new OptionSet () {
613 { "h|?|help", v => help = v != null },
614 { "generate-html:", v => mxap.GenerateHtml = ParseBool (v, mxap.GenerateHtml) },
615 { "include-mdb:", v => mxap.IncludeMdb = ParseBool (v, mxap.IncludeMdb) },
616 { "application-name=", v => mxap.ApplicationName = v },
617 { "generate-manifest:", v => mxap.GenerateManifest = ParseBool (v, mxap.GenerateManifest) },
618 { "use-existing-manifest", v => mxap.GenerateManifest = v == null },
619 { "entry-point-type=", v => mxap.EntryPointType = v },
620 { "cs-sources=", v => mxap.CSSources = v },
621 { "res-sources=", v => resourceFile = v },
622 { "ares-sources=", v => aresourceFile = v },
623 { "cres-sources=", v => cresourceFile = v },
624 { "desktop:", v => mxap.Desktop = ParseBool (v, mxap.Desktop) },
625 { "builddirhack=", v => mxap.TopBuildDir = v },
626 { "r=|reference=", v => mxap.ExternalAssemblies.Add (v) },
627 { "l:|list-generated:", v => mxap.ListGenerated = ParseBool (v, mxap.ListGenerated) },
628 { "v:|verbose:", v => mxap.Verbose = ParseBool (v, mxap.Verbose) },
629 { "res=|resource=", "-res=filename[,resource name]", v => resources.Add (v) },
630 { "ares=|assembly-resource=", "-ares=filename[,resource name]", v => aresources.Add (v) },
631 { "cres=|content-resource=", "-cres=filename[,resource name]", v => cresources.Add (v) },
632 { "d:|define:", "-d:name", v => mxap.Defines.Add (v) },
633 { "clean", "Removes generated files. Use with caution!", v => clean = v != null },
634 { "out=|output-dir=", v => mxap.OutputDir = v },
635 { "inplace:", "Don't use a temporary directory", v => mxap.InPlace = ParseBool (v, mxap.InPlace) },
636 { "runtime-version=|rv=", String.Format ("Select the Silverlight Runtime Version (2 = {0}, 3 = {1}, or use the full version string)", RuntimeVersion2, RuntimeVersion3), v => mxap.SetRuntimeVersion (v) }
639 List<string> extra = null;
640 try {
641 extra = p.Parse(args);
642 } catch (OptionException){
643 Console.WriteLine ("Try `mxap --help' for more information.");
644 return 1;
647 if (help){
648 ShowHelp (p);
649 return 0;
652 if (clean) {
653 DoClean (mxap.ApplicationName);
654 return 0;
657 if (extra.Count > 0)
658 mxap.Cd = Path.GetFullPath (extra [0]);
660 if (mxap.TopBuildDir == null && mxap.ExternalAssemblies.Count > 0) {
661 Console.Error.WriteLine ("--reference requires --builddirhack");
662 return 1;
665 if (mxap.OutputDir == null)
666 mxap.OutputDir = mxap.Cd;
667 else
668 mxap.OutputDir = Path.GetFullPath (mxap.OutputDir);
670 Directory.SetCurrentDirectory (mxap.Cd);
671 mxap.WorkingDir = mxap.Cd;
672 if (mxap.Verbose)
673 Console.WriteLine ("Using source directory " + mxap.WorkingDir);
675 if (!mxap.InPlace) {
676 mxap.TmpDir = Path.Combine (Path.GetTempPath(), Path.GetRandomFileName ());
678 if (mxap.Verbose)
679 Console.WriteLine ("Using temporary directory " + mxap.TmpDir);
681 Directory.CreateDirectory (mxap.TmpDir);
682 RecursiveCopy (mxap.WorkingDir, "", mxap.TmpDir);
685 if (resourceFile != null)
686 foreach (string res in File.ReadAllLines (resourceFile))
687 mxap.AddResource (res);
689 if (aresourceFile != null)
690 foreach (string res in File.ReadAllLines (aresourceFile))
691 mxap.AddAssemblyResource (res);
693 if (cresourceFile != null)
694 foreach (string res in File.ReadAllLines (cresourceFile))
695 mxap.AddContentResource (res);
697 foreach (string res in resources) {
698 mxap.AddResource (res);
701 foreach (string res in aresources) {
702 mxap.AddAssemblyResource (res);
705 foreach (string res in cresources) {
706 mxap.AddContentResource (res);
709 if (!mxap.InPlace) {
710 Directory.SetCurrentDirectory (mxap.TmpDir);
711 mxap.WorkingDir = mxap.TmpDir;
714 mxap.ReferenceAssemblies.AddRange (Directory.GetFiles (mxap.WorkingDir, "*.dll"));
715 mxap.XamlFiles.AddRange (Directory.GetFiles (mxap.WorkingDir, "*.xaml"));
716 if (mxap.CSSources == null) {
717 mxap.CSharpFiles.AddRange (Directory.GetFiles (mxap.WorkingDir, "*.cs"));
718 } else {
719 mxap.CSharpFiles.AddRange (File.ReadAllLines (mxap.CSSources));
722 if (mxap.IncludeMdb)
723 mxap.MdbFiles.AddRange (Directory.GetFiles (mxap.WorkingDir, "*.mdb"));
725 if (mxap.XamlFiles.Count == 0 || mxap.CSharpFiles.Count == 0) {
726 Console.Error.WriteLine ("No XAML files or C# files found");
727 ShowHelp (p);
728 return 1;
731 // Make sure we didn't add the Application assembly into the referenced assemblies
732 DirectoryInfo info = new DirectoryInfo (mxap.WorkingDir);
734 if (mxap.ReferenceAssemblies.Contains (Path.Combine (mxap.WorkingDir, info.Name + ".dll")))
735 mxap.ReferenceAssemblies.Remove (Path.Combine (mxap.WorkingDir, info.Name + ".dll"));
737 if (!mxap.Run ())
738 return 1;
740 if (mxap.Verbose)
741 Console.WriteLine ("Using Output directory " + mxap.OutputDir);
743 if (!Directory.Exists (mxap.OutputDir)) {
744 Console.WriteLine ("warning: output directory doesn't exist, defaulting to source directory " + mxap.Cd + " ...");
745 mxap.OutputDir = mxap.Cd;
748 if (!mxap.InPlace || mxap.Cd != mxap.OutputDir) {
749 string app = mxap.ApplicationName;
750 File.Copy (Path.Combine (mxap.WorkingDir, app + ".dll"), Path.Combine (mxap.OutputDir, app + ".dll"), true);
751 File.Copy (Path.Combine (mxap.WorkingDir, app + ".dll.mdb"), Path.Combine (mxap.OutputDir, app + ".dll.mdb"), true);
752 File.Copy (Path.Combine (mxap.WorkingDir, app + ".g.resources"), Path.Combine (mxap.OutputDir, app + ".g.resources"), true);
753 File.Copy (Path.Combine (mxap.WorkingDir, app + ".html"), Path.Combine (mxap.OutputDir, app + ".html"), true);
754 File.Copy (Path.Combine (mxap.WorkingDir, app + ".xap"), Path.Combine (mxap.OutputDir, app + ".xap"), true);
755 File.Copy (Path.Combine (mxap.WorkingDir, "AppManifest.xaml"), Path.Combine (mxap.OutputDir, "AppManifest.xaml"), true);
756 foreach (string file in Directory.GetFiles (mxap.WorkingDir, "*.g.cs"))
757 File.Copy (file, Path.Combine (mxap.OutputDir, Path.GetFileName (file)), true);
759 if (!mxap.InPlace)
760 Directory.Delete (mxap.TmpDir, true);
762 return 0;