当前位置: 首页>>代码示例>>C#>>正文


C# Solution.AddConfiguration方法代码示例

本文整理汇总了C#中Solution.AddConfiguration方法的典型用法代码示例。如果您正苦于以下问题:C# Solution.AddConfiguration方法的具体用法?C# Solution.AddConfiguration怎么用?C# Solution.AddConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Solution的用法示例。


在下文中一共展示了Solution.AddConfiguration方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExtraConfigurationInNewProject

		public async Task ExtraConfigurationInNewProject ()
		{
			string dir = Util.CreateTmpDir ("ConfigurationsInNewProject");

			var sol = new Solution ();
			sol.FileName = Path.Combine (dir, "TestSolution.sln");
			sol.AddConfiguration ("Debug", true);

			var p = Services.ProjectService.CreateDotNetProject ("C#");
			p.ItemId = "{3A83F683-760F-486C-8844-B0F079B30B25}";
			p.FileName = Path.Combine (dir, "TestProject.csproj");
			sol.RootFolder.Items.Add (p);

			Assert.AreEqual (1, p.RunConfigurations.Count);
			var es = p.RunConfigurations [0];
			Assert.AreEqual ("Default", es.Name);

			var conf = (AssemblyRunConfiguration) p.CreateRunConfiguration ("Extra");
			conf.ExternalConsole = true;
			p.RunConfigurations.Add (conf);

			await sol.SaveAsync (Util.GetMonitor ());

			string projectXml = File.ReadAllText (p.FileName);
			string projFile = Util.GetSampleProject ("run-configurations", "ConsoleProject", "ConsoleProject.new-project-extra.csproj");
			string newProjectXml = File.ReadAllText (projFile);
			Assert.AreEqual (Util.ToWindowsEndings (newProjectXml), projectXml);

			Assert.IsTrue (File.Exists (p.FileName + ".user"));

			projectXml = File.ReadAllText (p.FileName + ".user");
			newProjectXml = File.ReadAllText (projFile + ".user");
			Assert.AreEqual (newProjectXml, projectXml);
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:34,代码来源:RunConfigurations.cs

示例2: Setup

		static async Task<UnitTestTextEditorExtension> Setup (string input)
		{
			var tww = new TestWorkbenchWindow ();
			var content = new TestViewContent ();
			tww.ViewContent = content;
			content.ContentName = "/a.cs";
			content.Data.MimeType = "text/x-csharp";
			MonoDevelop.AnalysisCore.AnalysisOptions.EnableUnitTestEditorIntegration.Set (true);
			var doc = new Document (tww);

			var text = @"namespace NUnit.Framework {
	public class TestFixtureAttribute : System.Attribute {} 
	public class TestAttribute : System.Attribute {} 
} namespace TestNs { " + input +"}";
			int endPos = text.IndexOf ('$');
			if (endPos >= 0)
				text = text.Substring (0, endPos) + text.Substring (endPos + 1);

			content.Text = text;
			content.CursorPosition = System.Math.Max (0, endPos);

			var project = MonoDevelop.Ide.Services.ProjectService.CreateDotNetProject ("C#");
			project.Name = "test";
			project.FileName = "test.csproj";
			project.Files.Add (new ProjectFile ("/a.cs", BuildAction.Compile)); 

			var solution = new Solution ();
			solution.AddConfiguration ("", true); 
			solution.DefaultSolutionFolder.AddItem (project);
			using (var monitor = new ProgressMonitor ())
				await TypeSystemService.Load (solution, monitor);
			content.Project = project;
			doc.SetProject (project);

			var compExt = new UnitTestTextEditorExtension ();
			compExt.Initialize (doc.Editor, doc);
			content.Contents.Add (compExt);
			await doc.UpdateParseDocument ();
			TypeSystemService.Unload (solution);
			return compExt;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:41,代码来源:UnitTesteditorIntegrationTests.cs

示例3: CreateProjectWithFolders

		public static Solution CreateProjectWithFolders (string hint)
		{
			string dir = Util.CreateTmpDir (hint);
			Directory.CreateDirectory (Util.Combine (dir, "console-project"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution1"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution1", "library1"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution1", "library2"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution2"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution2", "console-project2"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution2", "nested-solution3"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution2", "nested-solution3", "library3"));
			Directory.CreateDirectory (Util.Combine (dir, "nested-solution2", "nested-solution3", "library4"));
			
			Solution sol = new Solution ();
			sol.FileName = Path.Combine (dir, "nested-solutions-mdp");
			SolutionConfiguration scDebug = sol.AddConfiguration ("Debug", true);
			SolutionConfiguration scRelease = sol.AddConfiguration ("Release", true);
			
			DotNetProject project1 = CreateProject (Util.Combine (dir, "console-project"), "C#", "console-project");
			project1.Files.Add (new ProjectFile (Path.Combine (project1.BaseDirectory, "Program.cs")));
			project1.Files.Add (new ProjectFile (Path.Combine (project1.BaseDirectory, "Properties", "AssemblyInfo.cs")));
			sol.RootFolder.Items.Add (project1);
			
			// nested-solution1
			
			SolutionFolder folder1 = new SolutionFolder ();
			sol.RootFolder.Items.Add (folder1);
			folder1.Name = "nested-solution1";
			
			DotNetProject projectLib1 = CreateProject (Util.Combine (dir, "nested-solution1", "library1"), "C#", "library1");
			projectLib1.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			projectLib1.Files.Add (new ProjectFile (Path.Combine (projectLib1.BaseDirectory, "MyClass.cs")));
			projectLib1.Files.Add (new ProjectFile (Path.Combine (projectLib1.BaseDirectory, "Properties", "AssemblyInfo.cs")));
			projectLib1.CompileTarget = CompileTarget.Library;
			folder1.Items.Add (projectLib1);
			
			DotNetProject projectLib2 = CreateProject (Util.Combine (dir, "nested-solution1", "library2"), "C#", "library2");
			projectLib2.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			projectLib2.Files.Add (new ProjectFile (Path.Combine (projectLib2.BaseDirectory, "MyClass.cs")));
			projectLib2.Files.Add (new ProjectFile (Path.Combine (projectLib2.BaseDirectory, "Properties", "AssemblyInfo.cs")));
			projectLib2.CompileTarget = CompileTarget.Library;
			folder1.Items.Add (projectLib2);
			
			// nested-solution2

			SolutionFolder folder2 = new SolutionFolder ();
			folder2.Name = "nested-solution2";
			sol.RootFolder.Items.Add (folder2);
			
			DotNetProject project2 = CreateProject (Util.Combine (dir, "nested-solution2", "console-project2"), "C#", "console-project2");
			project2.Files.Add (new ProjectFile (Path.Combine (project2.BaseDirectory, "Program.cs")));
			project2.Files.Add (new ProjectFile (Path.Combine (project2.BaseDirectory, "Properties", "AssemblyInfo.cs")));
			project2.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			
			// nested-solution3

			SolutionFolder folder3 = new SolutionFolder ();
			folder3.Name = "nested-solution3";
			
			DotNetProject projectLib3 = CreateProject (Util.Combine (dir, "nested-solution2", "nested-solution3", "library3"), "C#", "library3");
			projectLib3.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			projectLib3.Files.Add (new ProjectFile (Path.Combine (projectLib3.BaseDirectory, "MyClass.cs")));
			projectLib3.Files.Add (new ProjectFile (Path.Combine (projectLib3.BaseDirectory, "Properties", "AssemblyInfo.cs")));
			projectLib3.CompileTarget = CompileTarget.Library;
			folder3.Items.Add (projectLib3);
			
			DotNetProject projectLib4 = CreateProject (Util.Combine (dir, "nested-solution2", "nested-solution3", "library4"), "C#", "library4");
			projectLib4.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			projectLib4.Files.Add (new ProjectFile (Path.Combine (projectLib4.BaseDirectory, "MyClass.cs")));
			projectLib4.Files.Add (new ProjectFile (Path.Combine (projectLib4.BaseDirectory, "Properties", "AssemblyInfo.cs")));
			projectLib4.CompileTarget = CompileTarget.Library;
			folder3.Items.Add (projectLib4);
			
			folder2.Items.Add (folder3);
			folder2.Items.Add (project2);
			
			string file = Path.Combine (dir, "TestSolution.sln");
			sol.FileName = file;
			
			project1.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project1.References.Add (new ProjectReference (projectLib1));
			project1.References.Add (new ProjectReference (projectLib2));
			project1.References.Add (new ProjectReference (projectLib3));
			project1.References.Add (new ProjectReference (projectLib4));
			
			project2.References.Add (new ProjectReference (projectLib3));
			project2.References.Add (new ProjectReference (projectLib4));
			
			Assert.AreEqual (2, sol.Configurations.Count);
			Assert.AreEqual (6, scDebug.Configurations.Count);
			Assert.AreEqual (6, scRelease.Configurations.Count);
			
			return sol;
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:94,代码来源:TestProjectsChecks.cs

示例4: CreateConsoleSolution

		public static Solution CreateConsoleSolution (string hint)
		{
			string dir = Util.CreateTmpDir (hint);
			
			Solution sol = new Solution ();
			SolutionConfiguration scDebug = sol.AddConfiguration ("Debug", true);
			
			DotNetAssemblyProject project = new DotNetAssemblyProject ("C#");
			sol.RootFolder.Items.Add (project);
			Assert.AreEqual (0, project.Configurations.Count);
			
			InitializeProject (dir, project, "TestProject");
			project.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project.References.Add (new ProjectReference (ReferenceType.Package, "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project.References.Add (new ProjectReference (ReferenceType.Package, "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Program.cs")));
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Resource.xml"), BuildAction.EmbeddedResource));
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Excluded.xml"), BuildAction.Content));
			ProjectFile pf = new ProjectFile (Path.Combine (dir, "Copy.xml"), BuildAction.Content);
			pf.CopyToOutputDirectory = FileCopyMode.Always;
			project.Files.Add (pf);
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Nothing.xml"), BuildAction.None));
			
			Assert.IsFalse (scDebug.GetEntryForItem (project).Build);
			scDebug.GetEntryForItem (project).Build = true;
			
			SolutionConfiguration scRelease = sol.AddConfiguration ("Release", true);
			
			string file = Path.Combine (dir, "TestSolution.sln");
			sol.FileName = file;
			
			Assert.AreEqual (2, sol.Configurations.Count);
			Assert.AreEqual (1, scDebug.Configurations.Count);
			Assert.AreEqual (1, scRelease.Configurations.Count);
			Assert.AreEqual (2, project.Configurations.Count);
			foreach (var v in project.Files) {
				if (v.FilePath.FileName == "Program.cs") {
				File.WriteAllText (v.FilePath,
				                   @"
using System;

namespace Foo {
	public class MainClass {
		public static void Main (string [] args)
		{
		}
	}
}");
				} else {
					File.WriteAllText (v.FilePath, v.Name);
				}
			}
			return sol;
		}
开发者ID:segaman,项目名称:monodevelop,代码行数:54,代码来源:TestProjectsChecks.cs

示例5: CreateEditor

		static async Task<EditorInfo> CreateEditor (string text, bool isInCSharpContext)
		{
			string parsedText, editorText;
			int cursorPosition = text.IndexOf ('$');
			int endPos = text.IndexOf ('$', cursorPosition + 1);
			if (endPos == -1)
				parsedText = editorText = text.Substring (0, cursorPosition) + text.Substring (cursorPosition + 1);
			else {
				parsedText = text.Substring (0, cursorPosition) + new string (' ', endPos - cursorPosition) + text.Substring (endPos + 1);
				editorText = text.Substring (0, cursorPosition) + text.Substring (cursorPosition + 1, endPos - cursorPosition - 1) + text.Substring (endPos + 1);
				cursorPosition = endPos - 1;
			}

			var project = Services.ProjectService.CreateProject ("C#", "AspNetApp");

			project.FileName = UnitTests.TestBase.GetTempFile (".csproj");
			string file = UnitTests.TestBase.GetTempFile (extension);
			project.AddFile (file);

			var sev = new TestViewContent ();
			sev.Project = project;
			sev.ContentName = file;
			sev.Text = editorText;
			sev.CursorPosition = cursorPosition;

			var tww = new TestWorkbenchWindow ();
			tww.ViewContent = sev;

			var doc = new TestDocument (tww);
			doc.Editor.FileName = sev.ContentName;
			doc.UpdateProject (project);

			solution = new MonoDevelop.Projects.Solution ();
			solution.DefaultSolutionFolder.AddItem (project);
			solution.AddConfiguration ("", true);
			await TypeSystemServiceTestExtensions.LoadSolution (solution);

			var parser = new RazorTestingParser {
				Doc = doc
			};
			var options = new ParseOptions {
				Project = project,
				FileName = sev.ContentName,
				Content = new StringTextSource (parsedText)
			};
			var parsedDoc = (RazorCSharpParsedDocument)parser.Parse (options, default(CancellationToken)).Result;
			doc.HiddenParsedDocument = parsedDoc;

			var editorExtension = new RazorCSharpEditorExtension (doc, parsedDoc as RazorCSharpParsedDocument, isInCSharpContext);
			return new EditorInfo {
				Extension = editorExtension,
				EditorText = editorText,
				View = sev
			};
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:55,代码来源:RazorCompletionTesting.cs

示例6: GenerateSolution

        void GenerateSolution()
        {
            var solution = new Solution {
                Name = projectName
            };

            var progressMonitor = new SimpleProgressMonitor ();
            var solutionPath = Path.Combine (rootFolder, projectName, solution.Name);

            foreach (var target in xcodeProjectModel.Targets) {
                var projectPath = Path.Combine (rootFolder, projectName, target.Name, target.Name + ".csproj");
                var project = Project.LoadProject (projectPath, progressMonitor);
                solution.RootFolder.AddItem (project);
            }

            solution.AddConfiguration ("Debug|iPhoneSimulator", true);
            solution.AddConfiguration ("Release|iPhoneSimulator", true);
            solution.AddConfiguration ("Debug|iPhone", true);
            solution.AddConfiguration ("Release|iPhone", true);
            solution.AddConfiguration ("Ad-Hoc|iPhone", true);
            solution.AddConfiguration ("AppStore|iPhone", true);

            solution.Save (solutionPath, progressMonitor);
            IdeApp.Workspace.OpenWorkspaceItem (solutionPath + ".sln");
        }
开发者ID:newky2k,项目名称:sample-translator,代码行数:25,代码来源:SolutionGenerator.cs

示例7: MsSlnToCmbxHelper

		public Solution MsSlnToCmbxHelper (string slnFileName, IProgressMonitor monitor)
		{
			Solution solution = new Solution();
			
			monitor.BeginTask (GettextCatalog.GetString ("Importing solution"), 2);
			try
			{
				// We invoke the ParseSolution 
				// by passing the file obtained
				ParseSolution (slnFileName, monitor);

				// Create all of the prjx files form the csproj files
				monitor.BeginTask (null, projNameInfo.Values.Count * 2);
				
				foreach (CsprojInfo pi in projNameInfo.Values) {
					string mappedPath = MapPath (Path.GetDirectoryName (slnFileName), pi.csprojpath);
					if (mappedPath == null) {
						monitor.Step (2);
						monitor.ReportWarning (GettextCatalog.GetString ("Project file not found: ") + pi.csprojpath);
						continue;
					}
					SolutionEntityItem prj;
					if (pi.NeedsConversion)
						prj = CreatePrjxFromCsproj (mappedPath, monitor);
					else
						prj = (DotNetProject) Services.ProjectService.ReadSolutionItem (monitor, mappedPath);
					
					if (prj == null)
						return null;

					monitor.Step (1);
					solution.RootFolder.Items.Add (prj);
					foreach (ItemConfiguration conf in prj.Configurations) {
						if (!solution.GetConfigurations ().Contains (conf.Id))
							solution.AddConfiguration (conf.Id, false);
					}
					monitor.Step (1);
				}
				
				monitor.EndTask ();
				monitor.Step (1);

				solution.SetLocation (Path.GetDirectoryName (slnFileName), Path.GetFileNameWithoutExtension(slnFileName));
				
				monitor.Step (1);
				return solution;
			}
			catch (Exception e)
			{
				monitor.ReportError (GettextCatalog.GetString ("The solution could not be imported."), e);
				throw;
			}
			finally
			{
				monitor.EndTask ();
			}
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:57,代码来源:MsPrjHelper.cs

示例8: Configurations

		public void Configurations ()
		{
			int configChangedEvs = 0;
			int configChangedEvsSub = 0;
			
			Workspace ws = new Workspace ();
			ws.ConfigurationsChanged += delegate { configChangedEvs++; };

			Workspace cws1 = new Workspace ();
			cws1.ConfigurationsChanged += delegate { configChangedEvsSub++; };
			ws.Items.Add (cws1);
			
			Solution sol = new Solution ();
			cws1.Items.Add (sol);
			
			ReadOnlyCollection<string> configs = ws.GetConfigurations ();
			Assert.AreEqual (0, configs.Count);
			configs = cws1.GetConfigurations ();
			Assert.AreEqual (0, configs.Count);
			
			// Add configurations
			
			configChangedEvs = configChangedEvsSub = 0;
			sol.AddConfiguration ("c1", false);
			Assert.AreEqual (1, configChangedEvs);
			Assert.AreEqual (1, configChangedEvsSub);
			
			configs = ws.GetConfigurations ();
			Assert.AreEqual (1, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			configs = cws1.GetConfigurations ();
			Assert.AreEqual (1, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			
			configChangedEvs = configChangedEvsSub = 0;
			sol.AddConfiguration ("c2", false);
			Assert.AreEqual (1, configChangedEvs);
			Assert.AreEqual (1, configChangedEvsSub);
			
			configs = ws.GetConfigurations ();
			Assert.AreEqual (2, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			Assert.AreEqual ("c2", configs[1]);
			configs = cws1.GetConfigurations ();
			Assert.AreEqual (2, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			Assert.AreEqual ("c2", configs[1]);

			// Add another solution
			
			Solution sol2 = new Solution ();
			sol2.AddConfiguration ("c3", false);
			sol2.AddConfiguration ("c4", false);
			
			configChangedEvs = configChangedEvsSub = 0;
			cws1.Items.Add (sol2);
			Assert.AreEqual (1, configChangedEvs);
			Assert.AreEqual (1, configChangedEvsSub);
			
			configs = ws.GetConfigurations ();
			Assert.AreEqual (4, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			Assert.AreEqual ("c2", configs[1]);
			Assert.AreEqual ("c3", configs[2]);
			Assert.AreEqual ("c4", configs[3]);
			configs = cws1.GetConfigurations ();
			Assert.AreEqual (4, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			Assert.AreEqual ("c2", configs[1]);
			Assert.AreEqual ("c3", configs[2]);
			Assert.AreEqual ("c4", configs[3]);
			
			// Remove solution
			
			configChangedEvs = configChangedEvsSub = 0;
			cws1.Items.Remove (sol2);
			Assert.AreEqual (1, configChangedEvs);
			Assert.AreEqual (1, configChangedEvsSub);
			
			configs = ws.GetConfigurations ();
			Assert.AreEqual (2, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			Assert.AreEqual ("c2", configs[1]);
			configs = cws1.GetConfigurations ();
			Assert.AreEqual (2, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			Assert.AreEqual ("c2", configs[1]);
			
			// Remove configuration
			
			configChangedEvs = configChangedEvsSub = 0;
			sol.Configurations.RemoveAt (1);
			Assert.AreEqual (1, configChangedEvs);
			Assert.AreEqual (1, configChangedEvsSub);

			configs = ws.GetConfigurations ();
			Assert.AreEqual (1, configs.Count);
			Assert.AreEqual ("c1", configs[0]);
			configs = cws1.GetConfigurations ();
			Assert.AreEqual (1, configs.Count);
//.........这里部分代码省略.........
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:101,代码来源:WorkspaceTests.cs

示例9: Parse

		async Task<RazorCSharpParsedDocument> Parse (string text, bool isPreprocessed)
		{
			var project = Services.ProjectService.CreateDotNetProject ("C#", "AspNetApp");

			project.FileName = UnitTests.TestBase.GetTempFile (".csproj");
			string file = UnitTests.TestBase.GetTempFile (".cshtml");
			ProjectFile projectFile = project.AddFile (file);
			if (isPreprocessed)
				projectFile.Generator = "RazorTemplatePreprocessor";

			var sev = new TestViewContent ();
			sev.Project = project;
			sev.ContentName = file;
			sev.Text = text;

			var tww = new TestWorkbenchWindow ();
			tww.ViewContent = sev;

			var doc = new TestDocument (tww);
			doc.Editor.FileName = sev.ContentName;
			doc.UpdateProject (project);

			solution = new MonoDevelop.Projects.Solution ();
			solution.DefaultSolutionFolder.AddItem (project);
			solution.AddConfiguration ("", true);
			await TypeSystemServiceTestExtensions.LoadSolution (solution);

			var parser = new RazorTestingParser {
				Doc = doc
			};
			var options = new ParseOptions {
				Project = project,
				FileName = file,
				Content = new StringTextSource (text)
			};
			return (RazorCSharpParsedDocument)parser.Parse (options, default(CancellationToken)).Result;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:37,代码来源:RazorParserTests.cs

示例10: CreateConsoleSolution

		public static Solution CreateConsoleSolution (string hint)
		{
			string dir = Util.CreateTmpDir (hint);
			
			Solution sol = new Solution ();
			SolutionConfiguration scDebug = sol.AddConfiguration ("Debug", true);
			
			DotNetAssemblyProject project = new DotNetAssemblyProject ("C#");
			sol.RootFolder.Items.Add (project);
			Assert.AreEqual (0, project.Configurations.Count);
			
			InitializeProject (dir, project, "TestProject");
			project.References.Add (new ProjectReference (ReferenceType.Gac, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project.References.Add (new ProjectReference (ReferenceType.Gac, "System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project.References.Add (new ProjectReference (ReferenceType.Gac, "System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Main.cs")));
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Resource.xml"), BuildAction.EmbeddedResource));
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Excluded.xml"), BuildAction.Content));
			ProjectFile pf = new ProjectFile (Path.Combine (dir, "Copy.xml"), BuildAction.Content);
			pf.CopyToOutputDirectory = FileCopyMode.Always;
			project.Files.Add (pf);
			project.Files.Add (new ProjectFile (Path.Combine (dir, "Nothing.xml"), BuildAction.None));
			
			Assert.IsFalse (scDebug.GetEntryForItem (project).Build);
			scDebug.GetEntryForItem (project).Build = true;
			
			SolutionConfiguration scRelease = sol.AddConfiguration ("Release", true);
			
			string file = Path.Combine (dir, "TestSolution.sln");
			sol.FileName = file;
			
			Assert.AreEqual (2, sol.Configurations.Count);
			Assert.AreEqual (1, scDebug.Configurations.Count);
			Assert.AreEqual (1, scRelease.Configurations.Count);
			Assert.AreEqual (2, project.Configurations.Count);
			
			return sol;
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:38,代码来源:TestProjectsChecks.cs


注:本文中的Solution.AddConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。