tag:blogger.com,1999:blog-6694797453707339109.post3560140023506958577..comments2009-01-07T14:48:37.317-08:00Comments on Brumlemann: Why it is an error for MSBuild to build clean in the same order as it builds regularilyBrumlemannhttp://www.blogger.com/profile/14141594572684513092noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-6694797453707339109.post-54874953156149655282008-12-30T07:47:00.000-08:002008-12-30T07:47:00.000-08:00Thanks to Lutz Roeders Reflector (now RedGate) I d...Thanks to Lutz Roeders Reflector (now RedGate) I did a walk of the MSBuild Engine and found this:<BR/><BR/>private static string GetProjectDependencies(SolutionParser solution, ProjectInSolution project, string subTargetName)<BR/>{<BR/>ErrorUtilities.VerifyThrow(project != null, "We should always have a project for this method");<BR/>StringBuilder builder = new StringBuilder();<BR/>foreach (string str in project.Dependencies)<BR/>{<BR/>if (builder.Length != 0)<BR/>{<BR/>builder.Append(";");<BR/>}<BR/>string projectUniqueNameByGuid = solution.GetProjectUniqueNameByGuid(str);<BR/>ProjectFileErrorUtilities.VerifyThrowInvalidProjectFile(projectUniqueNameByGuid != null, "SubCategoryForSolutionParsingErrors", new BuildEventFileInfo(solution.SolutionFile), "SolutionParseProjectDepNotFoundError", new object[] { project.ProjectGuid, str });<BR/>builder.Append(ProjectInSolution.DisambiguateProjectTargetName(projectUniqueNameByGuid));<BR/>if ((subTargetName != null) && (subTargetName.Length > 0))<BR/>{<BR/>builder.Append(":");<BR/>builder.Append(subTargetName);<BR/>}<BR/>}<BR/>return builder.ToString();<BR/>}<BR/><BR/>The calling code is inside CreateSolutionProject(...) through calls to the AddTargetsFor<ProjectType> methods (where <ProjectType> is not a type parameter but short for the different project types the engine handles).<BR/><BR/>Now the problem with the GetProjectDependencies(...) method is that, even though it has a subTargetName parameter (attains values such as "Build", "Clean" etc), it always produce the same dependencies. But as I have, hopefully, clearly demonstrated the dependencies should be reversed when subTargetName == "Clean".<BR/><BR/>If this was open source I would have just gone ahead and fixed it before submitting it for peer review, but as it stands I have to wait for some of you guys in the MSBuild product group to fix this (alas!).Brumlemannhttps://www.blogger.com/profile/14141594572684513092noreply@blogger.comtag:blogger.com,1999:blog-6694797453707339109.post-14377701961409341232008-12-30T07:43:00.000-08:002008-12-30T07:43:00.000-08:00Denne kommentaren har blitt fjernet av forfatteren.Brumlemannhttps://www.blogger.com/profile/14141594572684513092noreply@blogger.com