Implement AssignProjectConfiguration task.
authorAnkit Jain <radical@corewars.org>
Wed, 22 Jul 2009 21:51:58 +0000 (21:51 -0000)
committerAnkit Jain <radical@corewars.org>
Wed, 22 Jul 2009 21:51:58 +0000 (21:51 -0000)
In class/Microsoft.Build.Tasks:

* Microsoft.Build.Tasks_test.dll.sources: Added
AssignProjectConfigurationTest.cs .

* Microsoft.Build.Tasks.dll.sources: Added
In class/Microsoft.Build.Tasks/Microsoft.Build.Tasks:

* AssignProjectConfiguration.cs (Execute): Implement.

In class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks:

* AssignProjectConfigurationTest.cs: New.

In tools/xbuild:

* xbuild/Microsoft.Common.targets (AssignProjectConfigurations): New.
(ResolveProjectReferences): Add dependency on AssignProjectConfigurations
target. Also, set the config and platform properties for the msbuild task
being invoked.
* xbuild/Microsoft.Common.tasks: Add AssignProjectConfiguration .

In tools/xbuild/tests:

* standalone/Project01: Change config mappings a bit to mix them up,
like Debug->Release etc. Update .proj file and final-outputs.txt.

svn path=/trunk/mcs/; revision=138461

13 files changed:
mcs/class/Microsoft.Build.Tasks/ChangeLog
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignProjectConfiguration.cs
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks_test.dll.sources
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs [new file with mode: 0644]
mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
mcs/tools/xbuild/ChangeLog
mcs/tools/xbuild/tests/ChangeLog
mcs/tools/xbuild/tests/standalone/Project01/Project01.sln
mcs/tools/xbuild/tests/standalone/Project01/Project01.sln.proj
mcs/tools/xbuild/tests/standalone/Project01/final-outputs.txt
mcs/tools/xbuild/xbuild/Microsoft.Common.targets
mcs/tools/xbuild/xbuild/Microsoft.Common.tasks

index 47d0deaa370c15ae3e35be937476481f266ba8e6..f52cdcb0b53e9c831d575e87655febfd2ef138d8 100644 (file)
@@ -1,10 +1,15 @@
+2009-07-23  Ankit Jain  <jankit@novell.com>
+
+       * Microsoft.Build.Tasks_test.dll.sources: Added
+       AssignProjectConfigurationTest.cs .
+
 2009-07-22  Ankit Jain  <jankit@novell.com>
 
        * Makefile: Add System.Core .
 
 2009-06-08  Ankit Jain  <jankit@novell.com>
 
-       * Microsoft.Build.Tasks_test.dll.sources: Added
+       * Microsoft.Build.Tasks.dll.sources: Added
        ResolvedReference.cs
 
 2009-05-14  Ankit Jain  <jankit@novell.com>
index 5f762c6e538ad201985e3dcab90f7cfb4787a0bf..e81fb1e2555d71fc4ff25183cb2b62a97b3b5fca 100644 (file)
@@ -3,8 +3,10 @@
 //
 // Author:
 //   Marek Sieradzki (marek.sieradzki@gmail.com)
+//   Ankit Jain (jankit@novell.com)
 //
 // (C) 2006 Marek Sieradzki
+// Copyright 2009 Novell, Inc (http://www.novell.com)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 
 using System;
 using System.IO;
+using System.Collections.Generic;
+using System.Xml;
 using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
 
 namespace Microsoft.Build.Tasks {
        public class AssignProjectConfiguration : ResolveProjectBase {
@@ -45,9 +50,91 @@ namespace Microsoft.Build.Tasks {
                [MonoTODO]
                public override bool Execute ()
                {
-                       return false;
+                       if (String.IsNullOrEmpty (solutionConfigurationContents))
+                               return true;
+
+                       XmlReader xr = null;
+                       Dictionary<Guid, string> guidToConfigPlatform = null;
+                       try {
+                               xr = XmlReader.Create (new StringReader (solutionConfigurationContents));
+                               guidToConfigPlatform = new Dictionary<Guid, string> ();
+
+                               xr.Read ();
+                               while (!xr.EOF) {
+                                       xr.Read ();
+                                       if (xr.NodeType != XmlNodeType.Element)
+                                               continue;
+
+                                       string guid_str = xr.GetAttribute ("Project");
+                                       string config_str = xr.ReadString ();
+
+                                       Guid guid;
+                                       if (!String.IsNullOrEmpty (guid_str) && !String.IsNullOrEmpty (config_str) &&
+                                               TryParseGuid (guid_str, out guid))
+                                               guidToConfigPlatform [guid] = config_str;
+                               }
+                       } catch (XmlException xe) {
+                               Log.LogError ("XmlException while parsing SolutionConfigurationContents: {0}",
+                                               xe.ToString ());
+
+                               return false;
+                       } finally {
+                               ((IDisposable)xr).Dispose ();
+                       }
+
+                       List<ITaskItem> tempAssignedProjects = new List<ITaskItem> ();
+                       List<ITaskItem> tempUnassignedProjects = new List<ITaskItem> ();
+                       foreach (ITaskItem item in ProjectReferences) {
+                               string config;
+
+                               string guid_str = item.GetMetadata ("Project");
+                               Guid guid;
+                               if (!TryParseGuid (guid_str, out guid)) {
+                                       Log.LogError ("Project reference '{0}' has invalid or missing guid for metadata 'Project'.",
+                                                       item.ItemSpec);
+                                       return false;
+                               }
+
+                               if (guidToConfigPlatform.TryGetValue (guid, out config)) {
+                                       string [] parts = config.Split (new char [] {'|'}, 2);
+
+                                       ITaskItem new_item = new TaskItem (item);
+
+                                       new_item.SetMetadata ("SetConfiguration", "Configuration=" + parts [0]);
+                                       new_item.SetMetadata ("SetPlatform", "Platform=" +
+                                                       ((parts.Length > 1) ? parts [1] : String.Empty));
+
+                                       tempAssignedProjects.Add (new_item);
+                               } else {
+                                       Log.LogWarning ("Project reference '{0}' could not be resolved.",
+                                                       item.ItemSpec);
+                                       tempUnassignedProjects.Add (item);
+                               }
+                       }
+
+                       assignedProjects = tempAssignedProjects.ToArray ();
+                       unassignedProjects = tempUnassignedProjects.ToArray ();
+
+                       return true;
                }
-               
+
+               bool TryParseGuid (string guid_str, out Guid guid)
+               {
+                       guid = Guid.Empty;
+                       try {
+                               guid = new Guid (guid_str);
+                       } catch (ArgumentNullException) {
+                               return false;
+                       } catch (FormatException) {
+                               return false;
+                       } catch (OverflowException) {
+                               return false;
+                       }
+
+                       return true;
+               }
+
+
                [Output]
                public ITaskItem[] AssignedProjects {
                        get { return assignedProjects; }
@@ -67,4 +154,4 @@ namespace Microsoft.Build.Tasks {
        }
 }
 
-#endif
\ No newline at end of file
+#endif
index 07525a4b467e04b338c372c2f50782804d50e9bb..fda294695442cef0d2b1214f0e39812cbf7101fe 100644 (file)
@@ -1,3 +1,7 @@
+2009-07-23  Ankit Jain  <jankit@novell.com>
+
+       * AssignProjectConfiguration.cs (Execute): Implement.
+
 2009-07-22  Ankit Jain  <jankit@novell.com>
 
        Fix bug #517974.
index 4f5e22bb87a298a75892c6cbec9d6eb1bcc8efa4..fecb85517402a7a2fc6260c889190b5ac9329ea8 100644 (file)
@@ -1,5 +1,6 @@
 Microsoft.Build.Tasks/ALTest.cs
 Microsoft.Build.Tasks/AssignCultureTest.cs
+Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs
 Microsoft.Build.Tasks/AssignTargetPathTest.cs
 Microsoft.Build.Tasks/CombinePathTest.cs
 Microsoft.Build.Tasks/CopyTest.cs
diff --git a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignProjectConfigurationTest.cs
new file mode 100644 (file)
index 0000000..1458c99
--- /dev/null
@@ -0,0 +1,183 @@
+//
+// AssignProjectConfigurationTest.cs
+//
+// Author:
+//   Ankit Jain (jankit@novell.com)
+//
+// Copyright 2009 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+using System;
+using System.Collections;
+using Microsoft.Build.BuildEngine;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Tasks;
+using Microsoft.Build.Utilities;
+using NUnit.Framework;
+using System.Text;
+
+namespace MonoTests.Microsoft.Build.Tasks
+{
+       [TestFixture]
+       public class AssignProjectConfigurationTest
+       {
+               [Test]
+               public void TestValidCase () {
+                       string[] guids = new string[] {
+                               "{88932AF5-A0AF-44F3-A202-5C88152F25CA}",
+                               "{88932AF5-A0AF-44F3-A202-5C88152FABC1}",
+                               "{3653C4D3-60C0-4657-8289-3922D0DFB933}",
+                               "{DAE34193-B5C7-4488-A911-29EE15C84CB8}",
+                               "{23F291D9-78DF-4133-8CF2-78CE104DDE63}",
+                               "asd"
+                       };
+
+                       string[] project_ref_guids = new string[] {
+                               "{88932AF5-A0AF-44F3-A202-5C88152F25CA}",
+                               "{88932AF5-A0AF-44F3-A202-5C88152faBC1}",
+                               "{3653C4D3-60C0-4657-8289-3922D0DFB933}",
+                               "{DAE34193-B5C7-4488-A911-29EE15C84CB8}",
+                               "{DAE34193-B5C7-4488-A911-29EE15C84CBE}"
+                       };
+
+                       CreateAndCheckProject (guids, project_ref_guids, new string[] {
+                                       "AssignedProjects : foo0.csproj;foo1.csproj;foo2.csproj;foo3.csproj: SetConfig: Configuration=Release",
+                                       "AssignedProjects : foo0.csproj: SetPlatform: Platform=AnyCPU0",
+                                       "AssignedProjects : foo1.csproj: SetPlatform: Platform=AnyCPU1",
+                                       "AssignedProjects : foo2.csproj: SetPlatform: Platform=AnyCPU2",
+                                       "AssignedProjects : foo3.csproj: SetPlatform: Platform=AnyCPU3",
+                                       "UnassignedProjects : foo4.csproj"},
+                                       true,
+                                        "A1#");
+               }
+
+               [Test]
+               public void TestInvalidProjectGuid ()
+               {
+                       string[] guids = new string[] {
+                               "{23F291D9-78DF-4133-8CF2-78CE104DDE63}",
+                       };
+
+                       string[] project_ref_guids = new string[] {
+                               "{DAE34193-B5C7-4488-A911-29EE15C84CB8}",
+                               "{23F291D9-78DF-4133-8CF2-78CE104DDE63}",
+                               "invalid guid"
+                       };
+
+                       CreateAndCheckProject (guids, project_ref_guids, null, false, "A1#");
+               }
+
+               [Test]
+               public void TestInvalidProjectGuidInSolutionConfigContents () {
+                       string[] guids = new string[] {
+                               "{23F291D9-78DF-4133-8CF2-78CE104DDE63}",
+                               "invalid guid"
+                       };
+
+                       string[] project_ref_guids = new string[] {
+                               "{DAE34193-B5C7-4488-A911-29EE15C84CB8}",
+                               "{23F291D9-78DF-4133-8CF2-78CE104DDE63}"
+                       };
+
+                       CreateAndCheckProject (guids, project_ref_guids,
+                               new string [] {
+                                       "AssignedProjects : foo1.csproj: SetConfig: Configuration=Release",
+                                       "AssignedProjects : foo1.csproj: SetPlatform: Platform=AnyCPU0",
+                                       "UnassignedProjects : foo0.csproj"
+                               }, true, "A1#");
+               }
+
+
+               void CreateAndCheckProject (string[] guids, string[] project_ref_guids, string[] messages, bool build_result, string prefix)
+               {
+                       Engine engine = new Engine (Consts.BinPath);
+                       Project project = engine.CreateNewProject ();
+                       TestMessageLogger testLogger = new TestMessageLogger ();
+                       engine.RegisterLogger (testLogger);
+
+                       string projectString = CreateProject (guids, project_ref_guids);
+                       project.LoadXml (projectString);
+
+                       try {
+                               Assert.AreEqual (build_result, project.Build (), "Build " + (build_result ? "failed" : "should've failed"));
+                               testLogger.DumpMessages ();
+                               if (!build_result || messages == null)
+                                       // build failed as expected, don't check outputs
+                                       return;
+                               for (int i = 0; i < messages.Length; i++)
+                                       testLogger.CheckLoggedMessageHead (messages [i], prefix + i.ToString ());
+                               Assert.AreEqual (0, testLogger.NormalMessageCount);
+                       } catch (AssertionException) {
+                               Console.WriteLine (projectString);
+                               testLogger.DumpMessages ();
+                               throw;
+                       }
+               }
+
+               string CreateProject (string[] guids, string[] project_ref_guids)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.Append (@"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">");
+                       sb.Append ("\n<UsingTask TaskName=\"Microsoft.Build.Tasks.AssignProjectConfiguration\" AssemblyName=\"Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" />\n");
+                       sb.AppendFormat (@"<PropertyGroup>{0}</PropertyGroup>", CreateSolutionConfigurationProperty (guids, "Release|AnyCPU"));
+                       sb.Append (CreateProjectReferencesItemGroup (project_ref_guids));
+
+                       sb.Append ("\n\t<Target Name=\"1\">\n");
+                       sb.Append ("\t\t<AssignProjectConfiguration ProjectReferences=\"@(ProjectReference)\" " +
+                                       " SolutionConfigurationContents=\"$(CurrentSolutionConfigurationContents)\">\n");
+                       sb.Append ("\t\t\t<Output TaskParameter=\"AssignedProjects\" ItemName = \"AssignedProjects\" />\n");
+                       sb.Append ("\t\t\t<Output TaskParameter=\"UnassignedProjects\" ItemName = \"UnassignedProjects\" />\n");
+                       sb.Append ("\t\t</AssignProjectConfiguration>\n");
+                       sb.Append ("<Message Text=\"AssignedProjects : @(AssignedProjects): SetConfig: %(AssignedProjects.SetConfiguration)\"/>\n");
+                       sb.Append ("<Message Text=\"AssignedProjects : @(AssignedProjects): SetPlatform: %(AssignedProjects.SetPlatform)\"/>\n");
+                       sb.Append ("<Message Text=\"UnassignedProjects : @(UnassignedProjects)\"/>\n");
+                       sb.Append ("</Target>\n");
+                       sb.Append ("</Project>");
+
+                       return sb.ToString ();
+               }
+
+               string CreateSolutionConfigurationProperty (string[] guids, string config_str)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.Append ("\n<CurrentSolutionConfigurationContents>\n");
+                               sb.Append ("\t<foo xmlns=\"\">\n");
+                               for (int i = 0; i < guids.Length; i++) {
+                                       sb.AppendFormat ("\t\t<bar Project=\"{0}\">{1}{2}</bar>\n",
+                                               guids[i], config_str, i);
+                               }
+                               sb.Append ("\t</foo>\n");
+
+                       sb.Append ("</CurrentSolutionConfigurationContents>\n");
+                       return sb.ToString ();
+               }
+
+               string CreateProjectReferencesItemGroup (string[] guids)
+               {
+                       StringBuilder sb = new StringBuilder ();
+                       sb.Append ("\n<ItemGroup>\n");
+                       for (int i = 0; i < guids.Length; i ++)
+                               sb.AppendFormat ("\t<ProjectReference Include=\"foo{1}.csproj\"><Project>{0}</Project></ProjectReference>\n", guids [i], i);
+                       sb.Append ("</ItemGroup>\n");
+                       return sb.ToString ();
+               }
+       }
+}
index 751943226e0cb074f13fa9135c064e7b3cf9037a..7b39850fd19055d62f9a5c27235b2de24dd5a7d7 100644 (file)
@@ -1,3 +1,7 @@
+2009-07-23  Ankit Jain  <jankit@novell.com>
+
+       * AssignProjectConfigurationTest.cs: New.
+
 2009-06-08  Ankit Jain  <jankit@novell.com>
 
        * CreateCSharpManifestResourceNameTest.cs (TestInvalidCulture): New.
index dd9a373eab95b46841cb6ec31474be0712e1cac5..78ac8c041e866d93dd9a734389f03e4950b171f4 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-23  Ankit Jain  <jankit@novell.com>
+
+       * xbuild/Microsoft.Common.targets (AssignProjectConfigurations): New.
+       (ResolveProjectReferences): Add dependency on AssignProjectConfigurations
+       target. Also, set the config and platform properties for the msbuild task
+       being invoked.
+       * xbuild/Microsoft.Common.tasks: Add AssignProjectConfiguration .
+
 2009-07-22  Ankit Jain  <jankit@novell.com>
 
        * xbuild/Microsoft.VisualBasic.targets (Vbc.References): Remove
index 0fba8da39d796e9eb225ee9bf4d4edea98602821..88370558c0b54ef10340338e39e0227cdfc38d6a 100644 (file)
@@ -1,3 +1,8 @@
+2009-07-23  Ankit Jain  <jankit@novell.com>
+
+       * standalone/Project01: Change config mappings a bit to mix them up,
+       like Debug->Release etc. Update .proj file and final-outputs.txt.
+
 2009-07-22  Ankit Jain  <jankit@novell.com>
 
        * standalone/Project01: Add references to two "external" assemblies
index 286f8de1620aea00ee8828fbbda74e6810758984..c7672882c4c033c93b676b3f3843e84402a03ecd 100644 (file)
@@ -17,26 +17,30 @@ Global
                Release|Any CPU = Release|Any CPU
        EndGlobalSection
        GlobalSection(ProjectConfigurationPlatforms) = postSolution
-               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Release|Any CPU.Build.0 = Release|Any CPU
-               {041F1C17-D792-499B-973E-512E45122B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {041F1C17-D792-499B-973E-512E45122B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {041F1C17-D792-499B-973E-512E45122B4A}.Debug|Any CPU.ActiveCfg = Release|Any CPU
+               {041F1C17-D792-499B-973E-512E45122B4A}.Debug|Any CPU.Build.0 = Release|Any CPU
                {041F1C17-D792-499B-973E-512E45122B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {041F1C17-D792-499B-973E-512E45122B4A}.Release|Any CPU.Build.0 = Release|Any CPU
+               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Release|Any CPU.Build.0 = Release|Any CPU
                {3653C4D3-60C0-4657-8289-3922D0DFB933}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
                {3653C4D3-60C0-4657-8289-3922D0DFB933}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {3653C4D3-60C0-4657-8289-3922D0DFB933}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {3653C4D3-60C0-4657-8289-3922D0DFB933}.Release|Any CPU.Build.0 = Release|Any CPU
-               {DAE34193-B5C7-4488-A911-29EE15C84CB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {DAE34193-B5C7-4488-A911-29EE15C84CB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {88932AF5-A0AF-44F3-A202-5C88152F25CA}.Release|Any CPU.Build.0 = Release|Any CPU
+               {DAE34193-B5C7-4488-A911-29EE15C84CB8}.Debug|Any CPU.ActiveCfg = Release|Any CPU
+               {DAE34193-B5C7-4488-A911-29EE15C84CB8}.Debug|Any CPU.Build.0 = Release|Any CPU
                {DAE34193-B5C7-4488-A911-29EE15C84CB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {DAE34193-B5C7-4488-A911-29EE15C84CB8}.Release|Any CPU.Build.0 = Release|Any CPU
-               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Debug|Any CPU.Build.0 = Debug|Any CPU
-               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Release|Any CPU.ActiveCfg = Release|Any CPU
-               {23F291D9-78DF-4133-8CF2-78CE104DDE63}.Release|Any CPU.Build.0 = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(MonoDevelopProperties) = preSolution
+               version = 0.1
+               StartupItem = Project01\Main.csproj
        EndGlobalSection
        GlobalSection(SolutionProperties) = preSolution
                HideSolutionNode = FALSE
index c713a60e48d04fb83650af3b7078381abb9ddb00..0fd248b5b478f7840eda211f23d6d42e3706bef3 100644 (file)
@@ -21,9 +21,9 @@
     <CurrentSolutionConfigurationContents>
       <SolutionConfiguration xmlns="">
         <ProjectConfiguration Project="{88932AF5-A0AF-44F3-A202-5C88152F25CA}">Debug|AnyCPU</ProjectConfiguration>
-        <ProjectConfiguration Project="{041F1C17-D792-499B-973E-512E45122B4A}">Debug|AnyCPU</ProjectConfiguration>
+        <ProjectConfiguration Project="{041F1C17-D792-499B-973E-512E45122B4A}">Release|AnyCPU</ProjectConfiguration>
         <ProjectConfiguration Project="{3653C4D3-60C0-4657-8289-3922D0DFB933}">Debug|AnyCPU</ProjectConfiguration>
-        <ProjectConfiguration Project="{DAE34193-B5C7-4488-A911-29EE15C84CB8}">Debug|AnyCPU</ProjectConfiguration>
+        <ProjectConfiguration Project="{DAE34193-B5C7-4488-A911-29EE15C84CB8}">Release|AnyCPU</ProjectConfiguration>
         <ProjectConfiguration Project="{23F291D9-78DF-4133-8CF2-78CE104DDE63}">Debug|AnyCPU</ProjectConfiguration>
       </SolutionConfiguration>
     </CurrentSolutionConfigurationContents>
     <MSBuild Projects="Project01\Main.csproj" Targets="Publish" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib1" Condition="'$(CurrentSolutionConfigurationContents)' != ''" DependsOnTargets="Lib2;Lib3">
-    <MSBuild Projects="Lib1\Lib1.csproj" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib1\Lib1.csproj" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib1\Lib1.csproj" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib1:Clean" Condition="'$(CurrentSolutionConfigurationContents)' != ''" DependsOnTargets="Lib2:Clean;Lib3:Clean">
-    <MSBuild Projects="Lib1\Lib1.csproj" Targets="Clean" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib1\Lib1.csproj" Targets="Clean" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib1\Lib1.csproj" Targets="Clean" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib1:Rebuild" Condition="'$(CurrentSolutionConfigurationContents)' != ''" DependsOnTargets="Lib2:Rebuild;Lib3:Rebuild">
-    <MSBuild Projects="Lib1\Lib1.csproj" Targets="Rebuild" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib1\Lib1.csproj" Targets="Rebuild" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib1\Lib1.csproj" Targets="Rebuild" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib1:Publish" Condition="'$(CurrentSolutionConfigurationContents)' != ''" DependsOnTargets="Lib2:Publish;Lib3:Publish">
-    <MSBuild Projects="Lib1\Lib1.csproj" Targets="Publish" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib1\Lib1.csproj" Targets="Publish" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib1\Lib1.csproj" Targets="Publish" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib2" Condition="'$(CurrentSolutionConfigurationContents)' != ''" DependsOnTargets="Lib4">
     <MSBuild Projects="Lib2\Lib2.csproj" Targets="Publish" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib3" Condition="'$(CurrentSolutionConfigurationContents)' != ''">
-    <MSBuild Projects="Lib3\Lib3.csproj" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib3\Lib3.csproj" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib3\Lib3.csproj" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib3:Clean" Condition="'$(CurrentSolutionConfigurationContents)' != ''">
-    <MSBuild Projects="Lib3\Lib3.csproj" Targets="Clean" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib3\Lib3.csproj" Targets="Clean" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib3\Lib3.csproj" Targets="Clean" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib3:Rebuild" Condition="'$(CurrentSolutionConfigurationContents)' != ''">
-    <MSBuild Projects="Lib3\Lib3.csproj" Targets="Rebuild" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib3\Lib3.csproj" Targets="Rebuild" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib3\Lib3.csproj" Targets="Rebuild" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib3:Publish" Condition="'$(CurrentSolutionConfigurationContents)' != ''">
-    <MSBuild Projects="Lib3\Lib3.csproj" Targets="Publish" Properties="Configuration=Debug; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
+    <MSBuild Projects="Lib3\Lib3.csproj" Targets="Publish" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Debug') and ('$(Platform)' == 'Any CPU') " />
     <MSBuild Projects="Lib3\Lib3.csproj" Targets="Publish" Properties="Configuration=Release; Platform=AnyCPU; BuildingSolutionFile=true; CurrentSolutionConfigurationContents=$(CurrentSolutionConfigurationContents); SolutionDir=$(SolutionDir); SolutionExt=$(SolutionExt); SolutionFileName=$(SolutionFileName); SolutionName=$(SolutionName); SolutionPath=$(SolutionPath)" Condition=" ('$(Configuration)' == 'Release') and ('$(Platform)' == 'Any CPU') " />
   </Target>
   <Target Name="Lib4" Condition="'$(CurrentSolutionConfigurationContents)' != ''">
index 937f825a04dd3191b0664d5b60e85fcdb590b4fb..bfe7ad20a7c869a16cbaa17848493c2097a66e29 100644 (file)
 ./Project01/bin/Debug/Project01.exe
 ./Project01/bin/Debug/abc.dll
 ./Project01/bin/Debug/bar.dll
-./Project01/bin/Debug/Lib1.dll.mdb
 ./Project01/bin/Debug/Lib1.dll
 ./Project01/bin/Debug/Lib4.dll.mdb
 ./Project01/bin/Debug/Project01.exe.mdb
 ./Project01/bin/Debug/Lib2.dll.mdb
 ./Project01/bin/Debug/Lib4.dll
 ./Project01/bin/Debug/en-US/Lib1.resources.dll
-./Lib3/bin/Debug/Lib3.dll.mdb
-./Lib3/bin/Debug/Lib3.dll
-./Lib1/bin/Debug/fr-CA/Lib1.resources.dll
-./Lib1/bin/Debug/fr-CA/Lib2.resources.dll
-./Lib1/bin/Debug/lib2_folder/Lib2.deploy.txt
-./Lib1/bin/Debug/Lib2.dll
-./Lib1/bin/Debug/fr-FR/Lib1.resources.dll
-./Lib1/bin/Debug/fr-FR/Lib2.resources.dll
-./Lib1/bin/Debug/Lib1.deploy.txt
-./Lib1/bin/Debug/Lib1.dll.mdb
-./Lib1/bin/Debug/Lib1.dll
-./Lib1/bin/Debug/Lib4.dll.mdb
-./Lib1/bin/Debug/Lib3.dll.mdb
-./Lib1/bin/Debug/Lib2.dll.mdb
-./Lib1/bin/Debug/Lib3.dll
-./Lib1/bin/Debug/Lib4.dll
-./Lib1/bin/Debug/en-US/Lib1.resources.dll
+./Lib3/bin/Release/Lib3.dll
+./Lib1/bin/Release/fr-CA/Lib1.resources.dll
+./Lib1/bin/Release/fr-CA/Lib2.resources.dll
+./Lib1/bin/Release/lib2_folder/Lib2.deploy.txt
+./Lib1/bin/Release/Lib2.dll
+./Lib1/bin/Release/fr-FR/Lib1.resources.dll
+./Lib1/bin/Release/fr-FR/Lib2.resources.dll
+./Lib1/bin/Release/Lib1.deploy.txt
+./Lib1/bin/Release/Lib1.dll
+./Lib1/bin/Release/Lib4.dll.mdb
+./Lib1/bin/Release/Lib2.dll.mdb
+./Lib1/bin/Release/Lib3.dll
+./Lib1/bin/Release/Lib4.dll
+./Lib1/bin/Release/en-US/Lib1.resources.dll
index 3b9c23f6aec09676bc205b13f2658f924fb38ae9..b5004ba8b358711ab0efbe4bb7875f9c63ce73f9 100644 (file)
                </ResolveAssemblyReference>
        </Target>
 
+       <Target
+               Name="AssignProjectConfigurations"
+               Condition="'@(ProjectReference)' != ''">
+
+               <Message Text="projectref: @(ProjectReference) ProjectReferenceWithConfiguration: @(ProjectReferenceWithConfiguration)"/>
+               <AssignProjectConfiguration
+                       ProjectReferences = "@(ProjectReference)"
+                       SolutionConfigurationContents = "$(CurrentSolutionConfigurationContents)">
+
+                       <Output TaskParameter = "AssignedProjects" ItemName = "ProjectReferenceWithConfiguration"/>
+               </AssignProjectConfiguration>
+               <Message Text="after, ProjectReferenceWithConfiguration: config %(ProjectReferenceWithConfiguration.SetConfiguration) %(ProjectReferenceWithConfiguration.SetPlatform)"/>
+       </Target>
+
+
        <Target
                Name="ResolveProjectReferences"
-               Condition=" '@(ProjectReference)' != ''"
+               DependsOnTargets="AssignProjectConfigurations"
        >
                <!-- FIXME: don't build if building a .sln, since project ref would already have been built -->
                <MSBuild
-                       Projects="@(ProjectReference)"
+                       Projects="@(ProjectReferenceWithConfiguration)"
                        Targets="GetTargetPath"
-               >
+                       Properties="%(ProjectReferenceWithConfiguration.SetConfiguration); %(ProjectReferenceWithConfiguration.SetPlatform)"
+                       Condition="'@(ProjectReferenceWithConfiguration)' != ''">
+
                        <Output TaskParameter="TargetOutputs" ItemName="ChildProjectReferences" />
                </MSBuild>
        </Target>
index 204713165b5e2f7ef3db21b1c3b6ea71cc49a30b..1d9364f58e6bf7d9f02aa24b5569167a6880e48c 100644 (file)
@@ -2,6 +2,7 @@
        <UsingTask TaskName="Microsoft.Build.Tasks.AL"                  AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.AssignTargetPath"    AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.AssignCulture"       AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+       <UsingTask TaskName="Microsoft.Build.Tasks.AssignProjectConfiguration"  AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.CallTarget"          AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.CombinePath"         AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <UsingTask TaskName="Microsoft.Build.Tasks.Copy"                AssemblyName="Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />