[Microsoft.Build.Tasks] Fix CodeTaskFactory to resolve user references
[mono.git] / mcs / class / Microsoft.Build.Tasks / Microsoft.Build.Tasks / AL.cs
index f0195f01e057ba46cd58d4e8f0b888d3b61ed819..9b94e3798c13b3330d3314b811577d5fbfbf1aff 100644 (file)
@@ -25,7 +25,6 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-#if NET_2_0
 
 using System;
 using System.Diagnostics;
@@ -37,8 +36,6 @@ using Mono.XBuild.Utilities;
 namespace Microsoft.Build.Tasks {
        public class AL : ToolTaskExtension {
        
-               Process alProcess;
-       
                public AL ()
                {
                }
@@ -59,9 +56,15 @@ namespace Microsoft.Build.Tasks {
                                else
                                        commandLine.AppendSwitch ("/delaysign-");
                        commandLine.AppendSwitchIfNotNull ("/description:", Description);
-                       if (EmbedResources != null)
-                               foreach (ITaskItem item in EmbedResources)
-                                       commandLine.AppendSwitchIfNotNull ("/embed:", item.ItemSpec);
+                       if (EmbedResources != null) {
+                               foreach (ITaskItem item in EmbedResources) {
+                                       string logical_name = item.GetMetadata ("LogicalName");
+                                       if (!string.IsNullOrEmpty (logical_name))
+                                               commandLine.AppendSwitchIfNotNull ("/embed:", string.Format ("{0},{1}", item.ItemSpec, logical_name));
+                                       else
+                                               commandLine.AppendSwitchIfNotNull ("/embed:", item.ItemSpec);
+                               }
+                       }
                        commandLine.AppendSwitchIfNotNull ("/evidence:", EvidenceFile);
                        commandLine.AppendSwitchIfNotNull ("/fileversion:", FileVersion);
                        commandLine.AppendSwitchIfNotNull ("/flags:", Flags);
@@ -100,7 +103,9 @@ namespace Microsoft.Build.Tasks {
 
                protected override string GenerateFullPathToTool ()
                {
-                       return Path.Combine (ToolPath, ToolExe);
+                       if (!string.IsNullOrEmpty (ToolPath))
+                               return Path.Combine (ToolPath, ToolExe);
+                       return ToolLocationHelper.GetPathToDotNetFrameworkFile (ToolExe, TargetDotNetFrameworkVersion.VersionLatest);
                }
 
                public string AlgorithmId {
@@ -236,9 +241,7 @@ namespace Microsoft.Build.Tasks {
                }
 
                protected override string ToolName {
-                       get {
-                               return MSBuildUtils.RunningOnWindows ? "al.bat" : "al";
-                       }
+                       get { return "al.exe"; }
                }
 
                public string Trademark {
@@ -263,4 +266,3 @@ namespace Microsoft.Build.Tasks {
        }
 }
 
-#endif