[xbuild] Error out, if no target is found in a project.
authorAnkit Jain <radical@corewars.org>
Fri, 14 Jan 2011 09:17:50 +0000 (14:47 +0530)
committerAnkit Jain <radical@corewars.org>
Fri, 14 Jan 2011 09:21:39 +0000 (14:51 +0530)
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs

index 0b468349770358724f60d4de44ce506c527337e9..fdb3d250fd7ba92f212bd18149ca6a2747f39c27 100644 (file)
@@ -305,12 +305,18 @@ namespace Microsoft.Build.BuildEngine {
                        }
                        
                        if (targetNames == null || targetNames.Length == 0) {
-                               if (defaultTargets != null && defaultTargets.Length != 0)
+                               if (defaultTargets != null && defaultTargets.Length != 0) {
                                        targetNames = defaultTargets;
-                               else if (firstTargetName != null)
+                               } else if (firstTargetName != null) {
                                        targetNames = new string [1] { firstTargetName};
-                               else
+                               } else {
+                                       if (targets == null || targets.Count == 0) {
+                                               LogError (fullFileName, "No target found in the project");
+                                               return false;
+                                       }
+
                                        return false;
+                               }
                        }
 
                        if (!initialTargetsBuilt) {