void LoadProjectConfigurationMappings (Section sec, List<string> lines, Solution sln, IProgressMonitor monitor)
{
if (sec == null || String.Compare (sec.Val, "postSolution", true) != 0)
return;
Dictionary<string, SolutionConfigurationEntry> cache = new Dictionary<string, SolutionConfigurationEntry> ();
Dictionary<string, string> ignoredProjects = new Dictionary<string, string> ();
SlnData slnData = GetSlnData (sln.RootFolder);
List<string> extras = new List<string> ();
for (int i = 0; i < sec.Count - 2; i ++) {
int lineNum = i + sec.Start + 1;
string s = lines [lineNum].Trim ();
extras.Add (s);
//Format:
// {projectGuid}.SolutionConfigName|SolutionPlatform.ActiveCfg = ProjConfigName|ProjPlatform
// {projectGuid}.SolutionConfigName|SolutionPlatform.Build.0 = ProjConfigName|ProjPlatform
// {projectGuid}.SolutionConfigName|SolutionPlatform.Deploy.0 = ProjConfigName|ProjPlatform
string [] parts = s.Split (new char [] {'='}, 2);
if (parts.Length < 2) {
LoggingService.LogDebug ("{0} ({1}) : Invalid format. Ignoring", sln.FileName, lineNum + 1);
continue;
}
string action;
string projConfig = parts [1].Trim ();
string left = parts [0].Trim ();
if (left.EndsWith (".ActiveCfg")) {
action = "ActiveCfg";
left = left.Substring (0, left.Length - 10);
} else if (left.EndsWith (".Build.0")) {
action = "Build.0";
left = left.Substring (0, left.Length - 8);
} else if (left.EndsWith (".Deploy.0")) {
action = "Deploy.0";
left = left.Substring (0, left.Length - 9);
} else {
LoggingService.LogWarning (GettextCatalog.GetString ("{0} ({1}) : Unknown action. Only ActiveCfg, Build.0 and Deploy.0 supported.",
sln.FileName, lineNum + 1));
continue;
}
string [] t = left.Split (new char [] {'.'}, 2);
if (t.Length < 2) {
LoggingService.LogDebug ("{0} ({1}) : Invalid format of the left side. Ignoring",
sln.FileName, lineNum + 1);
continue;
}
string projGuid = t [0].ToUpper ();
string slnConfig = t [1];
if (!slnData.ItemsByGuid.ContainsKey (projGuid)) {
if (ignoredProjects.ContainsKey (projGuid))
// already warned
continue;
LoggingService.LogWarning (GettextCatalog.GetString ("{0} ({1}) : Project with guid = '{2}' not found or not loaded. Ignoring",
sln.FileName, lineNum + 1, projGuid));
ignoredProjects [projGuid] = projGuid;
continue;
}
SolutionEntityItem item;
if (slnData.ItemsByGuid.TryGetValue (projGuid, out item)) {
string key = projGuid + "." + slnConfig;
SolutionConfigurationEntry combineConfigEntry = null;
if (cache.ContainsKey (key)) {
combineConfigEntry = cache [key];
} else {
combineConfigEntry = GetConfigEntry (sln, item, slnConfig);
combineConfigEntry.Build = false; // Not buildable by default. Build will be enabled if a Build.0 entry is found
cache [key] = combineConfigEntry;
}
/* If both ActiveCfg & Build.0 entries are missing
* for a project, then default values :
* ActiveCfg : same as the solution config
* Build : true
*
* ELSE
* if Build (true/false) for the project will
* will depend on presence/absence of Build.0 entry
*/
if (action == "ActiveCfg") {
combineConfigEntry.ItemConfiguration = FromSlnConfigurationId (projConfig);
} else if (action == "Build.0") {
combineConfigEntry.Build = true;
} else if (action == "Deploy.0") {
combineConfigEntry.Deploy = true;
}
}
extras.RemoveAt (extras.Count - 1);
}
slnData.SectionExtras ["ProjectConfigurationPlatforms"] = extras;
}