From 191f894328416347bb615c7957e51ee1eef2db47 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 4 Aug 2007 19:30:28 +0000 Subject: [PATCH] Use MSBuild 3.5. SharpDevelop can now compile C# 3.0 projects created with VS2008 Beta 2. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2627 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/CSharpBinding.csproj | 3 +- .../VBNetBinding/Project/VBNetBinding.csproj | 3 +- .../VBNetBinding/Project/VBNetBinding.sln | 19 - .../VBNetBinding/Project/VBNetBinding.suo | Bin 19456 -> 0 bytes .../WixBinding/Project/WixBinding.csproj | 3 +- .../NameCreationServiceValidNameTests.cs | 2 +- ...issingDialogIdDesignerLoaderTestFixture.cs | 2 +- ...IdSpecifiedForDesignerLoaderTestFixture.cs | 2 +- .../WixBinding/Test/WixBinding.Tests.csproj | 3 +- .../Misc/CodeAnalysis/CodeAnalysis.csproj | 3 +- .../Test/CodeCoverage.Tests.csproj | 3 +- src/Automated.proj | 2 +- .../Project/ICSharpCode.SharpDevelop.csproj | 21 +- .../Src/Project/MSBuildBasedProject.cs | 4 +- .../Base/Project/Src/Project/MSBuildEngine.cs | 352 ++++++------------ .../Project/Src/Project/MSBuildInternals.cs | 19 +- .../ICSharpCode.SharpDevelop.Tests.csproj | 3 +- .../Src/Services/FileUtility/FileUtility.cs | 3 +- .../ICSharpCode.SharpDevelop.Sda.csproj | 7 +- src/Main/StartUp/Project/app.template.config | 11 + src/Setup/Files.wxs | 47 +-- src/Setup/Setup.wxs | 20 +- src/SharpDevelop.Tests.sln | 4 +- src/SharpDevelop.sln | 295 ++++++++------- src/clean.bat | 2 +- src/debugbuild.bat | 2 +- src/prepareRelease.bat | 2 +- src/releasebuild.bat | 2 +- 28 files changed, 347 insertions(+), 492 deletions(-) delete mode 100644 src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.sln delete mode 100644 src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.suo diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj index 9431b180c6..e19d552cf8 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -10,6 +10,7 @@ False False OnSuccessfulBuild + v3.5 Library File False diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj index 75f5644473..aa105d683d 100644 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj +++ b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -10,6 +10,7 @@ 4 False False + v3.5 OnSuccessfulBuild Library File diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.sln b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.sln deleted file mode 100644 index 433f3ddae8..0000000000 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VBNetBinding", "VBNetBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.suo b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.suo deleted file mode 100644 index 7d336b6e574de503bc99d72e39c7db78d9bf3a03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19456 zcmeHOYmgLI6>gSCAQB}&NDN?xM-U?nv%vC-5O!x51KACP;iXPOW@mb5hn=0CboVT~ zkQl{R9zLR|5rdGJmqrQ3*Drrql;saiRiY;TNTn=I<%gxQ3R9M;k}~*xefw_r%+B2D znc1*eC=iYPAJ@=e@dtZFv%0EB$+_itvN@$ZdQG5IRG;NCS`2^e(4$aWC zCfpEjpFe+IJk&JYUZQa%f&ZedlQ4MmfXM*I`!ZlEFb%jIcn@#|FdcX=a3%0Q04ku( z1ZD%XfUAJ3fjPi6z_q~pfw{m3fcXG*##Kj~&d?*Z|xJd<57CYyxfqHUq4u4QUi;ck^42eiXRb%^yH|3(yI4 zxzDyE-2vR@=3_{A0lVG&UZnegkGc6zAdLgJyZQY{?*tNVK8Z91aKzcBG}2xmG!EWk4L;Xa1(NZ@TAdZOdK zj`1*%i=(`Wxf<76F@h<_l3B>Lp>z_z)baZiav3M(HH}}yG4tEBTk+N|c^8LX37e?n z_cltZNX}zb8Pz-Xr5jq4#vkq8UbNZ<-(KXZ**?}Ag8k#1hl)9*;w9fr#0_l)sg!>k z+MuHieUPl-$jnx@V=4I4XQ39d0j#qcQD)D$g-ZEz{h{5>LkbzRAgAO`Th-*)r^`@Z zQ2s0{?SCo%Ev}x#z`Nk+m3j>Te`oz;eL?xN?6#7L!!h|dAm%|U`h5^mpypEl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J;ABpGN!NhW_)5(NxhM zv$ub?`FHsx#eOh-MxHGRTlvNq+y75P7x+C4@kQK!4){Fq1^4;=NFM+mbn{9P6Cetj{)BW9tWNPo&=r(o(8@L zd>?oQ_yO=k;1uvIa2og#@Eq`C;3ok4aEWS@K%@HK3jc|b6QfDSLn8WNOz1yVm43k$ z=gw^^p8r;SpgX7At~V6Vo5lfru2S?c>^M#sU+n;Q`MIvruMqWkXDIdgkYgQxspaqa zUBxkZvH!jE`NT>HB(VKwSxKt($Ej2ntdKJPx*G460Mxt+#fl!^hum5B3D4gw?5J?J z!G=vV9Dls1xH5AM;vX)hlYpT7{onuXL*$=z&iwdwf!Me9uXc=PRK)Ke{WDHgR=(@U z4KZ3&D}O)VSI2n$QR}~qKl~$7?0abk>ygkDbXQ8q-*a()A@+b6 zN&Y{alXD)9cYm(hc__bF9PfSf=8S({c|I#W_lw&uG@*x$o?O5CcCP3VjrD#)qxQUf zJV_gVv7VGLI=mRX(916Z?JK{V$B1LBQ~$4lf%;D2Jp Bd~W~% diff --git a/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj b/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj index 24aa0ca160..39027f09dd 100644 --- a/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj +++ b/src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -10,6 +10,7 @@ Library 4 False + v3.5 False OnSuccessfulBuild False diff --git a/src/AddIns/BackendBindings/WixBinding/Test/DialogLoading/NameCreationServiceValidNameTests.cs b/src/AddIns/BackendBindings/WixBinding/Test/DialogLoading/NameCreationServiceValidNameTests.cs index 9e3e4b36e3..0642d9f20e 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/DialogLoading/NameCreationServiceValidNameTests.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/DialogLoading/NameCreationServiceValidNameTests.cs @@ -75,7 +75,7 @@ namespace WixBinding.Tests.DialogLoading } [Test] - [ExpectedException(typeof(Exception), "Invalid name 9")] + [ExpectedException(typeof(Exception), ExpectedMessage = "Invalid name 9")] public void ValidateNameThrowsExceptionWhenFirstCharIsDigit() { nameCreationService.ValidateName("9"); diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Gui/MissingDialogIdDesignerLoaderTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Gui/MissingDialogIdDesignerLoaderTestFixture.cs index 5b19f2d505..edf71cb7bc 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/Gui/MissingDialogIdDesignerLoaderTestFixture.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/Gui/MissingDialogIdDesignerLoaderTestFixture.cs @@ -32,7 +32,7 @@ namespace WixBinding.Tests.Gui ResourceService.RegisterNeutralStrings(rm); } [Test] - [ExpectedException(typeof(FormsDesignerLoadException), "Unable to find dialog with an id of 'MissingDialog'.")] + [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "Unable to find dialog with an id of 'MissingDialog'.")] public void LoadMissingDialog() { WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator()); diff --git a/src/AddIns/BackendBindings/WixBinding/Test/Gui/NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs b/src/AddIns/BackendBindings/WixBinding/Test/Gui/NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs index 24e4e915c6..ff7ae45eed 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/Gui/NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs +++ b/src/AddIns/BackendBindings/WixBinding/Test/Gui/NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs @@ -30,7 +30,7 @@ namespace WixBinding.Tests.Gui } [Test] - [ExpectedException(typeof(FormsDesignerLoadException), "No setup dialog selected in Wix document. Please move the cursor inside a dialog element or use the Setup Dialogs window to open a dialog.")] + [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "No setup dialog selected in Wix document. Please move the cursor inside a dialog element or use the Setup Dialogs window to open a dialog.")] public void NoDialogIdSpecified() { WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator()); diff --git a/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj b/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj index 27404d3e57..53bdc67830 100644 --- a/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj @@ -1,4 +1,4 @@ - + Library WixBinding.Tests @@ -15,6 +15,7 @@ 4096 4 false + v3.5 ..\..\..\..\..\bin\UnitTests\ diff --git a/src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj b/src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj index 37775b4371..8d3e9c2684 100644 --- a/src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj +++ b/src/AddIns/Misc/CodeAnalysis/CodeAnalysis.csproj @@ -1,4 +1,4 @@ - + Library ICSharpCode.CodeAnalysis @@ -16,6 +16,7 @@ 4096 4 false + v3.5 obj\ diff --git a/src/AddIns/Misc/CodeCoverage/Test/CodeCoverage.Tests.csproj b/src/AddIns/Misc/CodeCoverage/Test/CodeCoverage.Tests.csproj index c245627f4d..ce52f0cb81 100644 --- a/src/AddIns/Misc/CodeCoverage/Test/CodeCoverage.Tests.csproj +++ b/src/AddIns/Misc/CodeCoverage/Test/CodeCoverage.Tests.csproj @@ -1,4 +1,4 @@ - + Library ICSharpCode.CodeCoverage.Tests @@ -15,6 +15,7 @@ 4096 4 false + v3.5 ..\..\..\..\..\bin\UnitTests\ diff --git a/src/Automated.proj b/src/Automated.proj index f9d8bf83bb..3c8ce84830 100644 --- a/src/Automated.proj +++ b/src/Automated.proj @@ -19,7 +19,7 @@ properties available for the projects inside the solution (but this works using the command line) --> - "$(MSBuildBinPath)\msbuild.exe" + "$(MSBuildBinPath)\..\v3.5\msbuild.exe" /p:Configuration=Release $(BuildProperties) "/p:SharpDevelopBinPath=$(SharpDevelopBin)" $(BuildProperties) "/p:BooBinPath=$(SharpDevelopSrc)\AddIns\BackendBindings\Boo\RequiredLibraries" diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index b5f7d9eb4b..b22f0f72d7 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -21,26 +21,23 @@ 4096 false False - - - False - DEBUG,TRACE - True - ..\..\..\..\bin\ + 0809 4 - - - True - False ..\..\..\..\bin\ - 4 + v3.5 Full true + DEBUG,TRACE + False + True False + None + True + False diff --git a/src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs b/src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs index c8ba31f4f4..2b309805db 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs @@ -800,7 +800,9 @@ namespace ICSharpCode.SharpDevelop.Project public override void StartBuild(BuildOptions options) { RunMSBuild(this.ParentSolution, this, - this.ActiveConfiguration, this.ActivePlatform, options); + this.ParentSolution.Preferences.ActiveConfiguration, + this.ParentSolution.Preferences.ActivePlatform, + options); } internal static void RunMSBuild(Solution solution, IProject project, diff --git a/src/Main/Base/Project/Src/Project/MSBuildEngine.cs b/src/Main/Base/Project/Src/Project/MSBuildEngine.cs index 5adce7d3d5..df728221b6 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildEngine.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildEngine.cs @@ -164,7 +164,9 @@ namespace ICSharpCode.SharpDevelop.Project } catch (Exception ex) { MessageService.ShowError(ex); } - StartWorkerBuild(); + if (MSBuildEngine.isRunning) { + StartWorkerBuild(); + } } void Finish() @@ -190,32 +192,81 @@ namespace ICSharpCode.SharpDevelop.Project { parentEngine.MessageView.AppendLine("${res:MainWindow.CompilerMessages.BuildStarted}"); - if (project == null) { - LoggingService.Debug("Parsing solution file " + solution.FileName); - - Engine engine = CreateEngine(); - if (parentEngine.Configuration != null) { - engine.GlobalProperties.SetProperty("Configuration", parentEngine.Configuration); - } - if (parentEngine.Platform != null) { - engine.GlobalProperties.SetProperty("Platform", parentEngine.Platform); - } - Project solutionProject = LoadProject(engine, solution.FileName); - if (solutionProject == null) { - Finish(); - return; - } - if (!ParseSolution(solutionProject)) { - Finish(); - return; + // first parse the solution file into a MSBuild project + LoggingService.Debug("Parsing solution file " + solution.FileName); + + Engine engine = CreateEngine(); + if (parentEngine.Configuration != null) { + engine.GlobalProperties.SetProperty("Configuration", parentEngine.Configuration); + } + if (parentEngine.Platform != null) { + engine.GlobalProperties.SetProperty("Platform", parentEngine.Platform); + } + Project solutionProject = LoadProject(engine, solution.FileName); + if (solutionProject == null) { + Finish(); + return; + } + + // get the projects that should be built + IEnumerable projectsToBuildWithoutDependencies; + if (project == null) + projectsToBuildWithoutDependencies = solution.Projects; + else + projectsToBuildWithoutDependencies = GetAllReferencedProjects(project); + + projectsToBuild = Linq.ToList(Linq.Select( + projectsToBuildWithoutDependencies, + p => new ProjectToBuild(p.FileName, options.Target.TargetName) + )); + + Dictionary projectDict = new Dictionary(StringComparer.InvariantCultureIgnoreCase); + foreach (ProjectToBuild ptb in projectsToBuild) { + projectDict[ptb.file] = ptb; + } + + // use the information from the parsed solution file to determine build level, configuration and + // platform of the projects to build + + for (int level = 0;; level++) { + BuildItemGroup group = solutionProject.GetEvaluatedItemsByName("BuildLevel" + level); + if (group.Count == 0) + break; + foreach (BuildItem item in group) { + string path = FileUtility.GetAbsolutePath(solution.Directory, item.Include); + ProjectToBuild ptb; + if (projectDict.TryGetValue(path, out ptb)) { + ptb.level = level; + ptb.configuration = item.GetEvaluatedMetadata("Configuration"); + ptb.platform = item.GetEvaluatedMetadata("Platform"); + } else { + parentEngine.MessageView.AppendLine("Cannot build project file: " + path + " (project is not loaded by SharpDevelop)"); + } } - } else { - if (ParseMSBuildProject(project) == null) { - Finish(); - return; + } + + projectsToBuild.Sort( + delegate(ProjectToBuild ptb1, ProjectToBuild ptb2) { + if (ptb1.level == ptb2.level) { + return Path.GetFileName(ptb1.file).CompareTo(Path.GetFileName(ptb2.file)); + } else { + return ptb1.level.CompareTo(ptb2.level); + } + }); + + bool noProjectsToBuild = true; + for (int i = 0; i < projectsToBuild.Count; i++) { + if (projectsToBuild[i].level < 0) { + parentEngine.MessageView.AppendLine("Skipping " + Path.GetFileName(projectsToBuild[i].file)); + } else { + noProjectsToBuild = false; + break; } } - SortProjectsToBuild(); + if (noProjectsToBuild) { + parentEngine.MessageView.AppendLine("There are no projects to build."); + Finish(); + } } #endregion @@ -274,6 +325,7 @@ namespace ICSharpCode.SharpDevelop.Project } int lastUniqueWorkerID; + int currentBuildLevel; /// /// Find available work and run it on the specified worker. @@ -283,7 +335,7 @@ namespace ICSharpCode.SharpDevelop.Project ProjectToBuild nextFreeProject = null; lock (projectsToBuild) { foreach (ProjectToBuild ptb in projectsToBuild) { - if (ptb.buildStarted == false && ptb.DependenciesSatisfied()) { + if (ptb.buildStarted == false && ptb.level == currentBuildLevel) { if (nextFreeProject == null) { nextFreeProject = ptb; @@ -307,8 +359,26 @@ namespace ICSharpCode.SharpDevelop.Project } } if (nextFreeProject == null) { - // nothing to do for this worker thread - return false; + // are all projects on the current level done? + bool allDone = true; + foreach (ProjectToBuild ptb in projectsToBuild) { + if (ptb.level == currentBuildLevel) { + if (!ptb.buildFinished) { + allDone = false; + break; + } + } + } + if (allDone) { + currentBuildLevel++; + if (currentBuildLevel > projectsToBuild[projectsToBuild.Count - 1].level) { + return false; + } + return true; + } else { + // nothing to do for this worker thread + return false; + } } // now build nextFreeProject nextFreeProject.buildStarted = true; @@ -423,226 +493,42 @@ namespace ICSharpCode.SharpDevelop.Project } #endregion - #region ParseSolution - bool ParseSolution(Project solution) - { - // get the build target to call - Target mainBuildTarget = solution.Targets[options.Target.TargetName]; - if (mainBuildTarget == null) { - currentResults.Result = BuildResultCode.BuildFileError; - currentResults.Add(new BuildError(this.solution.FileName, "Target '" + options.Target + "' not supported by solution.")); - return false; - } - // example of mainBuildTarget: - // - // - // - List mainBuildTargetTasks = Linq.ToList(Linq.CastTo(mainBuildTarget)); - if (mainBuildTargetTasks.Count != 1 - || mainBuildTargetTasks[0].Name != "CallTarget") - { - return InvalidTarget(mainBuildTarget); - } - - List solutionTargets = new List(); - foreach (string solutionTargetName in mainBuildTargetTasks[0].GetParameterValue("Targets").Split(';')) - { - Target target = solution.Targets[solutionTargetName]; - if (target != null) { - solutionTargets.Add(target); - } - } - - // dictionary for fast lookup of ProjectToBuild elements - Dictionary projectsToBuildDict = new Dictionary(); - - // now look through targets that took like this: - // - // - // - // - // and add those targets to the "projectsToBuild" list. - foreach (Target target in solutionTargets) { - List tasks = Linq.ToList(Linq.CastTo(target)); - if (tasks.Count == 0) { - return InvalidTarget(target); - } - - // find task to run when this target is executed - BuildTask bestTask = null; - foreach (BuildTask task in tasks) { - if (task.Name != "MSBuild") { - return InvalidTarget(target); - } - if (MSBuildInternals.EvaluateCondition(solution, task.Condition)) { - bestTask = task; - } - } - if (bestTask == null) { - LoggingService.Warn("No matching condition for solution target " + target.Name); - bestTask = tasks[0]; - } - - // create projectToBuild entry and add it to list and dictionary - string projectFileName = Path.Combine(this.solution.Directory, bestTask.GetParameterValue("Projects")); - ProjectToBuild projectToBuild = new ProjectToBuild(FileUtility.NormalizePath(projectFileName), - bestTask.GetParameterValue("Targets")); - - // get project configuration and platform from properties section - string propertiesString = bestTask.GetParameterValue("Properties"); - Match match = Regex.Match(propertiesString, @"\bConfiguration=([^;]+);"); - if (match.Success) { - projectToBuild.configuration = match.Groups[1].Value; - } else { - projectToBuild.configuration = parentEngine.Configuration; - } - match = Regex.Match(propertiesString, @"\bPlatform=([^;]+);"); - if (match.Success) { - projectToBuild.platform = match.Groups[1].Value; - } else { - projectToBuild.platform = parentEngine.Platform; - if (projectToBuild.platform == "Any CPU") { - projectToBuild.platform = "AnyCPU"; - } - } - - projectsToBuild.Add(projectToBuild); - projectsToBuildDict[target.Name] = projectToBuild; - } - - // now create dependencies between projectsToBuild - foreach (Target target in solutionTargets) { - ProjectToBuild p1; - if (!projectsToBuildDict.TryGetValue(target.Name, out p1)) - continue; - foreach (string dependency in target.DependsOnTargets.Split(';')) { - ProjectToBuild p2; - if (!projectsToBuildDict.TryGetValue(dependency, out p2)) - continue; - p1.dependencies.Add(p2); - } - } - return true; - } - - /// - /// Adds an error message that the specified target is invalid and returns false. - /// - bool InvalidTarget(Target target) - { - currentResults.Result = BuildResultCode.BuildFileError; - currentResults.Add(new BuildError(this.solution.FileName, "Solution target '" + target.Name + "' is invalid.")); - return false; - } - #endregion - - #region ParseMSBuildProject - Dictionary parseMSBuildProjectProjectsToBuildDict = new Dictionary(); - + #region GetAllReferencedProjects /// - /// Adds a ProjectToBuild item for the project and it's project references. - /// Returns the added item, or null if an error occured. + /// Gets all projects referenced by the project. /// - ProjectToBuild ParseMSBuildProject(IProject project) + static ICollection GetAllReferencedProjects(IProject project) { - ProjectToBuild ptb; - if (parseMSBuildProjectProjectsToBuildDict.TryGetValue(project, out ptb)) { - // only add each project once, reuse existing ProjectToBuild - return ptb; - } - ptb = new ProjectToBuild(project.FileName, options.Target.TargetName); - ptb.configuration = parentEngine.Configuration; - ptb.platform = parentEngine.Platform; - - projectsToBuild.Add(ptb); - parseMSBuildProjectProjectsToBuildDict[project] = ptb; + HashSet referencedProjects = new HashSet(); + Stack stack = new Stack(); + referencedProjects.Add(project); + stack.Push(project); - foreach (ProjectItem item in project.GetItemsOfType(ItemType.ProjectReference)) { - ProjectReferenceProjectItem prpi = item as ProjectReferenceProjectItem; - if (prpi != null && prpi.ReferencedProject != null) { - ProjectToBuild referencedProject = ParseMSBuildProject(prpi.ReferencedProject); - if (referencedProject == null) - return null; - ptb.dependencies.Add(referencedProject); + while (stack.Count != 0) { + project = stack.Pop(); + foreach (ProjectItem item in project.GetItemsOfType(ItemType.ProjectReference)) { + ProjectReferenceProjectItem prpi = item as ProjectReferenceProjectItem; + if (prpi != null) { + if (referencedProjects.Add(prpi.ReferencedProject)) { + stack.Push(prpi.ReferencedProject); + } + } } } - return ptb; + return referencedProjects; } #endregion - #region SortProjectsToBuild - /// - /// Recursively count dependencies and sort projects (most important first). - /// This decreases the number of waiting workers on multi-processor builds - /// - void SortProjectsToBuild() - { - // count: - try { - foreach (ProjectToBuild ptb in projectsToBuild) { - projectsToBuild.ForEach(delegate(ProjectToBuild p) { p.visitFlag = 0; }); - ptb.dependencies.ForEach(IncrementRequiredByCount); - } - } catch (DependencyCycleException) { - currentResults.Add(new BuildError(null, "Dependency cycle detected, cannot build!")); - return; - } - // sort by requiredByCount, decreasing - projectsToBuild.Sort(delegate (ProjectToBuild a, ProjectToBuild b) { - return -a.requiredByCount.CompareTo(b.requiredByCount); - }); - } - - /// - /// Recursively increment requiredByCount on ptb and all its dependencies - /// - static void IncrementRequiredByCount(ProjectToBuild ptb) - { - if (ptb.visitFlag == 1) { - return; - } - if (ptb.visitFlag == -1) { - throw new DependencyCycleException(); - } - ptb.visitFlag = -1; - ptb.requiredByCount++; - ptb.dependencies.ForEach(IncrementRequiredByCount); - ptb.visitFlag = 1; - } - - class DependencyCycleException : Exception {} - #endregion } - /// - /// node used for project dependency graph - /// - internal class ProjectToBuild + internal sealed class ProjectToBuild { - // information required to build the project internal string file; + internal int level = -1; + internal string configuration; + internal string platform; internal string targets; - internal string configuration, platform; - - internal List dependencies = new List(); - - internal bool DependenciesSatisfied() - { - return dependencies.TrueForAll(delegate(ProjectToBuild p) { return p.buildFinished; }); - } - - /// - /// Number of projects that are directly or indirectly dependent on this project. - /// Used in SortProjectsToBuild step. - /// - internal int requiredByCount; - - /// - /// Mark already visited nodes. 0 = not visited, -1 = visiting, 1 = visited - /// Used in SortProjectsToBuild step. - /// - internal int visitFlag; // build status. Three possible values: // buildStarted=buildFinished=false => build not yet started @@ -651,7 +537,7 @@ namespace ICSharpCode.SharpDevelop.Project internal bool buildStarted; internal bool buildFinished; - public ProjectToBuild(string file, string targets) + internal ProjectToBuild(string file, string targets) { this.file = file; this.targets = targets; diff --git a/src/Main/Base/Project/Src/Project/MSBuildInternals.cs b/src/Main/Base/Project/Src/Project/MSBuildInternals.cs index f5f573ca02..e01b4b1df0 100644 --- a/src/Main/Base/Project/Src/Project/MSBuildInternals.cs +++ b/src/Main/Base/Project/Src/Project/MSBuildInternals.cs @@ -220,7 +220,8 @@ namespace ICSharpCode.SharpDevelop.Project public static MSBuild.Engine CreateEngine() { - return new MSBuild.Engine(System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory()); + return new MSBuild.Engine(MSBuild.ToolsetDefinitionLocations.Registry + | MSBuild.ToolsetDefinitionLocations.ConfigurationFile); } /// @@ -268,16 +269,16 @@ namespace ICSharpCode.SharpDevelop.Project } /// - /// Gets an array containing all custom metadata names. + /// Gets all custom metadata names defined directly on the item, ignoring defaulted metadata entries. /// - public static string[] GetCustomMetadataNames(MSBuild.BuildItem item) + public static IList GetCustomMetadataNames(MSBuild.BuildItem item) { - ArrayList a = (ArrayList)typeof(MSBuild.BuildItem).InvokeMember( - "GetAllCustomMetadataNames", - BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic, - null, item, null - ); - return (string[])a.ToArray(typeof(string)); + PropertyInfo prop = typeof(MSBuild.BuildItem).GetProperty("ItemDefinitionLibrary", BindingFlags.Instance | BindingFlags.NonPublic); + object oldValue = prop.GetValue(item, null); + prop.SetValue(item, null, null); + IList result = (IList)item.CustomMetadataNames; + prop.SetValue(item, oldValue, null); + return result; } static XmlElement CreateElement(XmlDocument document, string name) diff --git a/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj b/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj index 14e242f1e9..af75630af9 100644 --- a/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj +++ b/src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj @@ -1,4 +1,4 @@ - + Debug AnyCPU @@ -23,6 +23,7 @@ False AnyCPU false + v3.5 true diff --git a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs index fe386e60ec..5324ec7cd8 100644 --- a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs +++ b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs @@ -172,8 +172,7 @@ namespace ICSharpCode.Core } /// - /// Converts a given relative path and a given base path to a path that leads - /// to the relative path absoulte. + /// Combines baseDirectoryPath with relPath and normalizes the resulting path. /// public static string GetAbsolutePath(string baseDirectoryPath, string relPath) { diff --git a/src/Main/ICSharpCode.SharpDevelop.Sda/ICSharpCode.SharpDevelop.Sda.csproj b/src/Main/ICSharpCode.SharpDevelop.Sda/ICSharpCode.SharpDevelop.Sda.csproj index 516ab717a3..fbfcc0155e 100644 --- a/src/Main/ICSharpCode.SharpDevelop.Sda/ICSharpCode.SharpDevelop.Sda.csproj +++ b/src/Main/ICSharpCode.SharpDevelop.Sda/ICSharpCode.SharpDevelop.Sda.csproj @@ -1,4 +1,4 @@ - + Library ICSharpCode.SharpDevelop.Sda @@ -13,16 +13,19 @@ Auto 100663296 AnyCPU + v3.5 4096 4 false ..\..\..\bin\ICSharpCode.SharpDevelop.Sda.xml - False True ..\ICSharpCode.SharpDevelop.snk False File + obj\ diff --git a/src/Main/StartUp/Project/app.template.config b/src/Main/StartUp/Project/app.template.config index 08c2a114f5..20723149f3 100644 --- a/src/Main/StartUp/Project/app.template.config +++ b/src/Main/StartUp/Project/app.template.config @@ -37,6 +37,17 @@ + + + + + + + + + + + diff --git a/src/Setup/Files.wxs b/src/Setup/Files.wxs index 390e764631..a443d5f977 100644 --- a/src/Setup/Files.wxs +++ b/src/Setup/Files.wxs @@ -852,43 +852,20 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - + + - - - + @@ -1097,8 +1074,10 @@ + diff --git a/src/Setup/Setup.wxs b/src/Setup/Setup.wxs index 31bd3a87d4..ba0fba725c 100644 --- a/src/Setup/Setup.wxs +++ b/src/Setup/Setup.wxs @@ -53,11 +53,11 @@ Note that SharpDevelop 3.0 will eventually use WiX 3.0 where the NETFRAMEWORK30 property is already defined. --> - - + + - - Installed OR NETFRAMEWORK30 + + Installed OR NETFRAMEWORK35