Merge pull request #901 from Blewzman/FixAggregateExceptionGetBaseException
[mono.git] / mcs / class / Microsoft.Build.Tasks / Microsoft.Build.Tasks / AL.cs
index bfda2c7c9029b0d640f1a4709e26022c55ace1aa..1fc961b72dc1f56a4865b6a55bb1c583ef706087 100644 (file)
@@ -37,12 +37,11 @@ using Mono.XBuild.Utilities;
 namespace Microsoft.Build.Tasks {
        public class AL : ToolTaskExtension {
        
-               Process alProcess;
-       
                public AL ()
                {
                }
                
+               [MonoTODO]
                protected internal override void AddResponseFileCommands (
                                                 CommandLineBuilderExtension commandLine)
                {
@@ -50,23 +49,27 @@ namespace Microsoft.Build.Tasks {
                        commandLine.AppendSwitchIfNotNull ("/baseaddress:", BaseAddress);
                        commandLine.AppendSwitchIfNotNull ("/company:", CompanyName);
                        commandLine.AppendSwitchIfNotNull ("/configuration:", Configuration);
-                       commandLine.AppendSwitchIfNotNull ("/copyright:", Copyright);
                        commandLine.AppendSwitchIfNotNull ("/culture:", Culture);
-                       if (DelaySign == true)
-                               commandLine.AppendSwitch ("/delaysign");
+                       commandLine.AppendSwitchIfNotNull ("/copyright:", Copyright);
+                       if (Bag ["DelaySign"] != null)
+                               if (DelaySign)
+                                       commandLine.AppendSwitch ("/delaysign+");
+                               else
+                                       commandLine.AppendSwitch ("/delaysign-");
+                       commandLine.AppendSwitchIfNotNull ("/description:", Description);
                        if (EmbedResources != null)
                                foreach (ITaskItem item in EmbedResources)
-                                       commandLine.AppendSwitchIfNotNull ("/embedresource:", item.ItemSpec);
+                                       commandLine.AppendSwitchIfNotNull ("/embed:", item.ItemSpec);
                        commandLine.AppendSwitchIfNotNull ("/evidence:", EvidenceFile);
                        commandLine.AppendSwitchIfNotNull ("/fileversion:", FileVersion);
                        commandLine.AppendSwitchIfNotNull ("/flags:", Flags);
-                       if (GenerateFullPaths == true)
+                       if (GenerateFullPaths)
                                commandLine.AppendSwitch ("/fullpaths");
                        commandLine.AppendSwitchIfNotNull ("/keyname:", KeyContainer);
                        commandLine.AppendSwitchIfNotNull ("/keyfile:", KeyFile);
                        if (LinkResources != null)
                                foreach (ITaskItem item in LinkResources)
-                                       commandLine.AppendSwitchIfNotNull ("/linkresource:", item.ItemSpec);
+                                       commandLine.AppendSwitchIfNotNull ("/link:", item.ItemSpec);
                        commandLine.AppendSwitchIfNotNull ("/main:", MainEntryPoint);
                        if (OutputAssembly != null)
                                commandLine.AppendSwitchIfNotNull ("/out:", OutputAssembly.ItemSpec);
@@ -90,20 +93,14 @@ namespace Microsoft.Build.Tasks {
                
                public override bool Execute ()
                {
-                       CommandLineBuilderExtension clbe = new CommandLineBuilderExtension ();
-                       AddResponseFileCommands (clbe);
-                       
-                       alProcess = new Process ();
-                       alProcess.StartInfo.Arguments = clbe.ToString ();
-                       alProcess.StartInfo.FileName = GenerateFullPathToTool ();
-                       alProcess.Start ();
-                       alProcess.WaitForExit ();
-                       return true;
+                       return base.Execute ();
                }
 
                protected override string GenerateFullPathToTool ()
                {
-                       return Path.Combine (ToolPath, ToolName);
+                       if (!string.IsNullOrEmpty (ToolPath))
+                               return Path.Combine (ToolPath, ToolExe);
+                       return ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest);
                }
 
                public string AlgorithmId {
@@ -192,6 +189,7 @@ namespace Microsoft.Build.Tasks {
                }
 
                [Required]
+               [Output]
                public ITaskItem OutputAssembly {
                        get { return (ITaskItem) Bag ["OutputAssembly"]; }
                        set { Bag ["OutputAssembly"] = value; }
@@ -238,9 +236,7 @@ namespace Microsoft.Build.Tasks {
                }
 
                protected override string ToolName {
-                       get {
-                               return "al";
-                       }
+                       get { return "al.exe"; }
                }
 
                public string Trademark {
@@ -265,4 +261,4 @@ namespace Microsoft.Build.Tasks {
        }
 }
 
-#endif
\ No newline at end of file
+#endif