本文整理汇总了C#中NAnt.Core.PropertyDictionary.AddReadOnly方法的典型用法代码示例。如果您正苦于以下问题:C# PropertyDictionary.AddReadOnly方法的具体用法?C# PropertyDictionary.AddReadOnly怎么用?C# PropertyDictionary.AddReadOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NAnt.Core.PropertyDictionary
的用法示例。
在下文中一共展示了PropertyDictionary.AddReadOnly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
/// <summary>
/// Starts NAnt. This is the Main entry point.
/// </summary>
/// <param name="args">Command Line args, or whatever you want to pass it. They will treated as Command Line args.</param>
/// <returns>
/// The exit code.
/// </returns>
public static int Main(string[] args)
{
CommandLineParser commandLineParser = null;
Project project = null;
Level projectThreshold = Level.Info;
// create assembly resolver
AssemblyResolver assemblyResolver = new AssemblyResolver();
// attach assembly resolver to the current domain
assemblyResolver.Attach();
CommandLineOptions cmdlineOptions = new CommandLineOptions();
try {
commandLineParser = new CommandLineParser(typeof(CommandLineOptions), true);
commandLineParser.Parse(args, cmdlineOptions);
if (!cmdlineOptions.NoLogo) {
Console.WriteLine(commandLineParser.LogoBanner);
// insert empty line
Console.WriteLine();
}
if (cmdlineOptions.ShowHelp) {
ConsoleDriver.ShowHelp(commandLineParser);
return 0;
}
// determine the project message threshold
if (cmdlineOptions.Debug) {
projectThreshold = Level.Debug;
} else if (cmdlineOptions.Verbose) {
projectThreshold = Level.Verbose;
} else if (cmdlineOptions.Quiet) {
projectThreshold = Level.Warning;
}
if (cmdlineOptions.BuildFile != null) {
if (project != null) {
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "Buildfile has already been loaded! Using new value '{0}'; discarding old project file '{1}'", cmdlineOptions.BuildFile, project.BuildFileUri));
// insert empty line
Console.WriteLine();
}
project = new Project(cmdlineOptions.BuildFile, projectThreshold, cmdlineOptions.IndentationLevel);
}
// get build file name if the project has not been created.
// If a build file was not specified on the command line.
if (project == null) {
project = new Project(GetBuildFileName(Environment.CurrentDirectory, null, cmdlineOptions.FindInParent), projectThreshold, cmdlineOptions.IndentationLevel);
}
// load extension asseemblies
LoadExtensionAssemblies(cmdlineOptions.ExtensionAssemblies, project);
PropertyDictionary buildOptionProps = new PropertyDictionary(project);
// add build logger and build listeners to project
ConsoleDriver.AddBuildListeners(cmdlineOptions, project);
// copy cmd line targets
foreach (string target in cmdlineOptions.Targets) {
project.BuildTargets.Add(target);
}
// build collection of valid properties that were specified on
// the command line.
foreach (string key in cmdlineOptions.Properties) {
buildOptionProps.AddReadOnly(key,
cmdlineOptions.Properties.Get(key));
}
// add valid properties to the project.
foreach (System.Collections.DictionaryEntry de in buildOptionProps) {
project.Properties.AddReadOnly((string) de.Key, (string) de.Value);
}
//add these here and in the project .ctor
Assembly ass = Assembly.GetExecutingAssembly();
project.Properties.AddReadOnly(Project.NAntPropertyFileName, ass.Location);
project.Properties.AddReadOnly(Project.NAntPropertyVersion, ass.GetName().Version.ToString());
project.Properties.AddReadOnly(Project.NAntPropertyLocation, Path.GetDirectoryName(ass.Location));
if (cmdlineOptions.TargetFramework != null) {
FrameworkInfo framework = project.Frameworks[cmdlineOptions.TargetFramework];
if (framework != null) {
try {
framework.Validate();
project.TargetFramework = framework;
} catch (Exception ex) {
//.........这里部分代码省略.........