public static Solution CreateSolution(string name)
        {
            var solution = new Solution();
            solution.Name = name;
            solution.Version = SolutionVersion.VS2010;

            var solutionConfigPlatforms = new SolutionSection()
            {
                Name = "SolutionConfigurationPlatforms",
                Type = "preSolution",
                SectionType = "Global",
            };

            solutionConfigPlatforms.Add(new KeyValuePair<string,string>("Debug|Any CPU", "Debug|Any CPU"));
            solutionConfigPlatforms.Add(new KeyValuePair<string,string>("Release|Any CPU", "Release|Any CPU"));

            solution.GlobalSections.Add(solutionConfigPlatforms);

            var solutionProperties = new SolutionSection()
            {
                Name = "SolutionProperties",
                Type = "preSolution",
                SectionType = "Global",
            };

            solutionProperties.Add(new KeyValuePair<string,string>("HideSolutionNode", "FALSE"));
            solution.GlobalSections.Add(solutionProperties);

            return solution;
        }
Beispiel #2
0
        public static Solution CreateSolution(string name)
        {
            var solution = new Solution();

            solution.Name    = name;
            solution.Version = SolutionVersion.VS2010;

            var solutionConfigPlatforms = new SolutionSection()
            {
                Name        = "SolutionConfigurationPlatforms",
                Type        = "preSolution",
                SectionType = "Global",
            };

            solutionConfigPlatforms.Add(new KeyValuePair <string, string>("Debug|Any CPU", "Debug|Any CPU"));
            solutionConfigPlatforms.Add(new KeyValuePair <string, string>("Release|Any CPU", "Release|Any CPU"));

            solution.GlobalSections.Add(solutionConfigPlatforms);

            var solutionProperties = new SolutionSection()
            {
                Name        = "SolutionProperties",
                Type        = "preSolution",
                SectionType = "Global",
            };

            solutionProperties.Add(new KeyValuePair <string, string>("HideSolutionNode", "FALSE"));
            solution.GlobalSections.Add(solutionProperties);

            return(solution);
        }
		public void GlobalSection()
		{
			SolutionSection section = new SolutionSection("ProjectConfigurationPlatforms", "postSolution");
			section.Add("{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg", "Debug|Any CPU");
			section.Add("{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg", "Release|Any CPU");
			StringWriter w = new StringWriter();
			new SolutionWriter(w).WriteGlobalSection(section);
			Assert.AreEqual("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution" + w.NewLine +
			                "\t\t{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Debug|Any CPU.ActiveCfg = Debug|Any CPU" + w.NewLine +
			                "\t\t{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}.Release|Any CPU.ActiveCfg = Release|Any CPU" + w.NewLine +
			                "\tEndGlobalSection" + w.NewLine
			                , w.ToString());
		}
Beispiel #4
0
		SolutionSection GenerateNestingSection(ISolution solution)
		{
			SolutionSection section = new SolutionSection("NestedProjects", "preSolution");
			foreach (var item in solution.AllItems) {
				if (item is ISolutionFileItem)
					continue; // file items are a special case as they're saved in their own section
				if (item.ParentFolder != solution) {
					section.Add(GuidToString(item.IdGuid), GuidToString(item.ParentFolder.IdGuid));
				}
			}
			return section;
		}
Beispiel #5
0
		SolutionSection GenerateProjectConfigurationSection(ISolution solution)
		{
			SolutionSection section = new SolutionSection("ProjectConfigurationPlatforms", "postSolution");
			foreach (var project in solution.Projects) {
				foreach (var configuration in solution.ConfigurationNames) {
					foreach (var platform in solution.PlatformNames) {
						var solutionConfig = new ConfigurationAndPlatform(configuration, platform);
						var projectConfig = project.ConfigurationMapping.GetProjectConfiguration(solutionConfig);
						string key = GuidToString(project.IdGuid) + "." + solutionConfig;
						string value = projectConfig.Configuration + "|" + MSBuildInternals.FixPlatformNameForSolution(projectConfig.Platform);
						section.Add(key + ".ActiveCfg", value);
						if (project.ConfigurationMapping.IsBuildEnabled(solutionConfig))
							section.Add(key + ".Build.0", value);
						if (project.ConfigurationMapping.IsDeployEnabled(solutionConfig))
							section.Add(key + ".Deploy.0", value);
					}
				}
			}
			return section;
		}
Beispiel #6
0
		SolutionSection GenerateSolutionConfigurationSection(IConfigurable solution)
		{
			SolutionSection section = new SolutionSection("SolutionConfigurationPlatforms", "preSolution");
			foreach (var config in solution.ConfigurationNames) {
				foreach (var platform in solution.PlatformNames) {
					string key = config + "|" + platform;
					section.Add(key, key);
				}
			}
			return section;
		}
Beispiel #7
0
		public void WriteSolutionItem(ISolutionItem item)
		{
			ISolutionFolder folder = item as ISolutionFolder;
			IProject project = item as IProject;
			if (folder != null) {
				WriteProjectHeader(ProjectTypeGuids.SolutionFolder, folder.Name, folder.Name, folder.IdGuid);
				// File items are represented as nodes in the tree, but they're actually
				// saved as properties on their containing folder.
				SolutionSection section = new SolutionSection("SolutionItems", "preProject");
				foreach (var file in folder.Items.OfType<ISolutionFileItem>()) {
					string location = FileUtility.GetRelativePath(basePath, file.FileName);
					section.Add(location, location);
				}
				WriteProjectSection(section);
				writer.WriteLine("EndProject");
			} else if (project != null) {
				string location = FileUtility.GetRelativePath(basePath, project.FileName);
				WriteProjectHeader(project.TypeGuid, project.Name, location, project.IdGuid);
				foreach (var section in project.ProjectSections) {
					WriteProjectSection(section);
				}
				writer.WriteLine("EndProject");
			}
		}
Beispiel #8
0
        private SolutionSection ReadSection(Match match)
        {
            var section = new SolutionSection();
            section.Name = match.Groups["Name"].Value;
            section.SectionType = match.Groups["SectionType"].Value;
            section.Type = match.Groups["Type"].Value;

            ReadNextLine();
            Match sectionMatch;
            while (IsAtKeyValuePair(out sectionMatch))
            {
                section.Add(ReadKeyValuePair(sectionMatch));
                ReadNextLine();
            }

            if (_currentLine != string.Format("End{0}Section", section.SectionType))
                ThrowSyntaxError(string.Format("Expected \"End{0}Section\" keyword.", section.SectionType));

            return section;
        }
Beispiel #9
0
		void ReadSectionEntries(SolutionSection section)
		{
			while (currentLine != null) {
				int pos = currentLine.IndexOf('=');
				if (pos < 0)
					break; // end of section
				string key = currentLine.Substring(0, pos).Trim();
				string value = currentLine.Substring(pos + 1).Trim();
				section.Add(key, value);
				NextLine();
			}
		}
        public void AddVariableToExtensibilityGlobals(string name, string value)
        {
            SolutionSection section = GetExtensibilityGlobalsSection();

            section.Add(name, value);
        }