Skip to content

Commit

Permalink
parse solution folder files, if FULL_SLN_PARSER define
Browse files Browse the repository at this point in the history
  • Loading branch information
enricosada committed Aug 5, 2017
1 parent 345c4d1 commit 8ba14e6
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public sealed class ProjectInSolution
private string _targetFrameworkMoniker; // used for website projects, since they don't have a project file in which the
// target framework is stored. Defaults to .NETFX 3.5

#if FULL_SLN_PARSER
private List<string> _folderFiles; // A list of name and path of files inside a solution folder
#endif

/// <summary>
/// The project configuration in given solution configuration
/// K: full solution configuration name (cfg + platform)
Expand Down Expand Up @@ -133,6 +137,10 @@ internal ProjectInSolution(SolutionFile solution)
_aspNetConfigurations = new Hashtable(StringComparer.OrdinalIgnoreCase);

_projectConfigurations = new Dictionary<string, ProjectConfigurationInSolution>(StringComparer.OrdinalIgnoreCase);

#if FULL_SLN_PARSER
_folderFiles = new List<string>();
#endif
}

#endregion
Expand Down Expand Up @@ -252,6 +260,16 @@ internal string TargetFrameworkMoniker
set { _targetFrameworkMoniker = value; }
}

#if FULL_SLN_PARSER
/// <summary>
/// Only apply to solution folder
/// </summary>
public IReadOnlyList<string> FolderFiles
{
get { return _folderFiles.AsReadOnly(); }
}
#endif

#endregion

#region Methods
Expand Down Expand Up @@ -411,6 +429,16 @@ internal void UpdateUniqueProjectName(string newUniqueName)
_uniqueProjectName = newUniqueName;
}

#if FULL_SLN_PARSER
/// <summary>
/// Add the folder file.
/// </summary>
internal void AddFolderFile(string relativeFilePath)
{
_folderFiles.Add(relativeFilePath);
}
#endif

/// <summary>
/// Cleanse the project name, by replacing characters like '@', '$' with '_'
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions vendor/msbuild/src/Build/Construction/Solution/SolutionFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,29 @@ private void ParseProject(string firstLine)
line = ReadLine();
}
}
#if FULL_SLN_PARSER
else if (line.StartsWith("ProjectSection(SolutionItems)", StringComparison.Ordinal))
{
// We have a SolutionItems section. Each subsequent line should identify
// a solution item.
line = ReadLine();
while ((line != null) && (!line.StartsWith("EndProjectSection", StringComparison.Ordinal)))
{
proj.ProjectType = SolutionProjectType.SolutionFolder;

// This should be a dependency. The GUID identifying the parent project should
// be both the property name and the property value.
Match match = s_crackPropertyLine.Value.Match(line);
if (match.Success)
{
string relativeFilePath = match.Groups["PROPERTYNAME"].Value.Trim();
proj.AddFolderFile(relativeFilePath);
}

line = ReadLine();
}
}
#endif
else if (line.StartsWith("ProjectSection(WebsiteProperties)", StringComparison.Ordinal))
{
// We have a WebsiteProperties section. This section is present only in Venus
Expand Down

0 comments on commit 8ba14e6

Please sign in to comment.