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


C# DotNetProject.GetConfiguration方法代码示例

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


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

示例1: CheckConfigurationMappings

        static void CheckConfigurationMappings(DotNetProject project, string currentConfig)
        {
            var projConfig = (DotNetProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
            if (project.GetConfigurations ().Contains (currentConfig) && projConfig.Name != currentConfig)
                LogIssue (project, "configuration", currentConfig, projConfig.Name);

            if (currentConfig.IndexOf ("Debug", StringComparison.OrdinalIgnoreCase) != -1)
                return;

            // Fixup entries for release configs.
            var debugEntry = project.ParentSolution
                .GetConfiguration (new SolutionConfigurationSelector (currentConfig.Replace ("Release", "Debug")))
                .GetEntryForItem (project);
            if (debugEntry == null)
                return;

            IdeApp.Workspace.ActiveConfigurationId = currentConfig;

            var entry = project.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration).GetEntryForItem (project);
            entry.Build = debugEntry.Build;
            entry.Deploy = debugEntry.Deploy;

            var newConfig = debugEntry.ItemConfiguration.Replace ("Debug", "Release");
            if (project.GetConfigurations ().Any (config => config == newConfig))
                entry.ItemConfiguration = newConfig;
            else {
                LogIssue (project, "configuration", newConfig, "Missing");
                entry.ItemConfiguration = debugEntry.ItemConfiguration;
            }
        }
开发者ID:Therzok,项目名称:ConfigurationValidator,代码行数:30,代码来源:ConfigurationValidator.cs

示例2: CompilerOptionsPanelWidget

		public CompilerOptionsPanelWidget (DotNetProject project)
		{
			this.Build();
			this.project = project;
			DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
			CSharpCompilerParameters compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters;
			CSharpProjectParameters projectParameters = (CSharpProjectParameters) configuration.ProjectParameters;
			
			ListStore store = new ListStore (typeof (string));
			store.AppendValues (GettextCatalog.GetString ("Executable"));
			store.AppendValues (GettextCatalog.GetString ("Library"));
			store.AppendValues (GettextCatalog.GetString ("Executable with GUI"));
			store.AppendValues (GettextCatalog.GetString ("Module"));
			compileTargetCombo.Model = store;
			CellRendererText cr = new CellRendererText ();
			compileTargetCombo.PackStart (cr, true);
			compileTargetCombo.AddAttribute (cr, "text", 0);
			compileTargetCombo.Active = (int) configuration.CompileTarget;
			compileTargetCombo.Changed += new EventHandler (OnTargetChanged);
			
			if (project.IsLibraryBasedProjectType) {
				//fixme: should we totally hide these?
				compileTargetCombo.Sensitive = false;
				mainClassEntry.Sensitive = false;
			} else {
				classListStore = new ListStore (typeof(string));
				mainClassEntry.Model = classListStore;
				mainClassEntry.TextColumn = 0;
				((Entry)mainClassEntry.Child).Text = projectParameters.MainClass ?? string.Empty;
			
				UpdateTarget ();
			}
			
			// Load the codepage. If it matches any of the supported encodigs, use the encoding name 			
			string foundEncoding = null;
			foreach (TextEncoding e in TextEncoding.SupportedEncodings) {
				if (e.CodePage == -1)
					continue;
				if (e.CodePage == projectParameters.CodePage)
					foundEncoding = e.Id;
				codepageEntry.AppendText (e.Id);
			}
			if (foundEncoding != null)
				codepageEntry.Entry.Text = foundEncoding;
			else if (projectParameters.CodePage != 0)
				codepageEntry.Entry.Text = projectParameters.CodePage.ToString ();
			
			iconEntry.Path = projectParameters.Win32Icon;
			iconEntry.DefaultPath = project.BaseDirectory;
			allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
			noStdLibCheckButton.Active = compilerParameters.NoStdLib;

			ListStore langVerStore = new ListStore (typeof (string));
			langVerStore.AppendValues (GettextCatalog.GetString ("Default"));
			langVerStore.AppendValues ("ISO-1");
			langVerStore.AppendValues ("ISO-2");
			langVerCombo.Model = langVerStore;
			langVerCombo.Active = (int) compilerParameters.LangVersion;
		}
开发者ID:kthguru,项目名称:monodevelop,代码行数:59,代码来源:CompilerOptionsPanelWidget.cs

示例3: CheckConfigurationProperties

        static void CheckConfigurationProperties(DotNetProject project)
        {
            var projConfig = (DotNetProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
            bool isDebug = projConfig.Name.IndexOf ("Debug", StringComparison.OrdinalIgnoreCase) != -1;
            bool shouldHaveDebugSymbols = true; // isDebug; // This is for general case.
            bool shouldBeOptimized = !isDebug;
            string[] debugTypeValues = isDebug ? new[] { "full" } : new[] { "pdbonly" }; // Should be none for release, but MD is pdbonly.

            if (projConfig.DebugMode != shouldHaveDebugSymbols) {
                LogIssue (project, "DebugSymbols", shouldHaveDebugSymbols, projConfig.DebugMode);
                projConfig.DebugMode = shouldHaveDebugSymbols;
                shouldSave = true;
            }

            var args = projConfig.CompilationParameters as MonoDevelop.CSharp.Project.CSharpCompilerParameters;
            if (args == null)
                return;

            if (!debugTypeValues.Any (value => value.Equals (args.DebugType, StringComparison.OrdinalIgnoreCase))) {
                LogIssue (project, "DebugType", debugTypeValues.First (), args.DebugType);
                args.DebugType = debugTypeValues.First ();
                shouldSave = true;
            }

            if (args.Optimize != shouldBeOptimized) {
                LogIssue (project, "Optimize", shouldBeOptimized, args.Optimize);
                args.Optimize = shouldBeOptimized;
                shouldSave = true;
            }

            if (isDebug)
                return;

            // Fixup to release properties.
            var debugConfig = (DotNetProjectConfiguration)project.GetConfiguration (new ItemConfigurationSelector (projConfig.Name.Replace ("Release", "Debug")));
            projConfig.DelaySign = debugConfig.DelaySign;
            projConfig.OutputAssembly = debugConfig.OutputAssembly;
            projConfig.SignAssembly = debugConfig.SignAssembly;
            projConfig.CommandLineParameters = debugConfig.CommandLineParameters;
            projConfig.ExternalConsole = debugConfig.ExternalConsole;
            projConfig.OutputDirectory = debugConfig.OutputDirectory;
            projConfig.RunWithWarnings = debugConfig.RunWithWarnings;
            projConfig.PauseConsoleOutput = debugConfig.PauseConsoleOutput;

            var debugArgs = debugConfig.CompilationParameters as MonoDevelop.CSharp.Project.CSharpCompilerParameters;
            if (debugArgs == null)
                return;

            args.DefineSymbols = debugArgs.DefineSymbols.Replace ("DEBUG", "").Trim(',', ';').Replace(",,", ",").Replace(";;", ";");
            args.DocumentationFile = debugArgs.DocumentationFile;
            args.GenerateOverflowChecks = debugArgs.GenerateOverflowChecks;
            args.LangVersion = debugArgs.LangVersion;
            args.NoStdLib = debugArgs.NoStdLib;
            args.NoWarnings = debugArgs.NoWarnings;
            args.TreatWarningsAsErrors = debugArgs.TreatWarningsAsErrors;
            args.PlatformTarget = debugArgs.PlatformTarget;
            args.UnsafeCode = debugArgs.UnsafeCode;
            args.WarningLevel = debugArgs.WarningLevel;
            args.WarningsNotAsErrors = debugArgs.WarningsNotAsErrors;
        }
开发者ID:Therzok,项目名称:ConfigurationValidator,代码行数:60,代码来源:ConfigurationValidator.cs

示例4: CheckDefineSymbols

        static void CheckDefineSymbols(DotNetProject project)
        {
            var projConfig = (DotNetProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
            bool shouldContainDebug = projConfig.Name.IndexOf ("Debug", StringComparison.OrdinalIgnoreCase) != -1;
            bool shouldContainMac = projConfig.Name.IndexOf ("Mac", StringComparison.OrdinalIgnoreCase) != -1;
            bool shouldContainWin = projConfig.Name.IndexOf ("Win32", StringComparison.OrdinalIgnoreCase) != -1;

            if (projConfig.GetDefineSymbols ().Any (symbol => symbol.Equals ("DEBUG", StringComparison.OrdinalIgnoreCase)) != shouldContainDebug) {
                var expected = shouldContainDebug ? "DEBUG" : "";
                var actual = shouldContainDebug ? "" : "DEBUG";
                LogIssue (project, "symbols", expected, actual);
            }

            if (projConfig.GetDefineSymbols ().Any (symbol => symbol.Equals ("MAC", StringComparison.OrdinalIgnoreCase)) != shouldContainMac) {
                var expected = shouldContainMac ? "MAC" : "";
                var actual = shouldContainMac ? "" : "MAC";
                LogIssue (project, "symbols", expected, actual);
            }

            if (projConfig.GetDefineSymbols ().Any (symbol => symbol.Equals ("WIN32", StringComparison.OrdinalIgnoreCase)) != shouldContainWin) {
                var expected = shouldContainWin ? "WIN32" : "";
                var actual = shouldContainWin ? "" : "WIN32";
                LogIssue (project, "symbols", expected, actual);
            }
        }
开发者ID:Therzok,项目名称:ConfigurationValidator,代码行数:25,代码来源:ConfigurationValidator.cs


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