本文整理汇总了C#中NAnt.Core.Project类的典型用法代码示例。如果您正苦于以下问题:C# Project类的具体用法?C# Project怎么用?C# Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Project类属于NAnt.Core命名空间,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProjectSettingsLoader
/// <summary>
/// Initializes a new instance of the <see cref="ProjectSettingsLoader" />
/// class for the given <see cref="Project" />.
/// </summary>
/// <param name="project">The <see cref="Project" /> that should be configured.</param>
internal ProjectSettingsLoader(Project project) {
_project = project;
// setup namespace manager
_nsMgr = new XmlNamespaceManager(new NameTable());
_nsMgr.AddNamespace("nant", _nsMgr.DefaultNamespace);
}
示例2: ExpressionEvalBase
public ExpressionEvalBase(Project project)
{
if (project == null)
throw new ArgumentNullException("project");
_project = project;
}
示例3: Test_FilesInResources
public void Test_FilesInResources() {
string buildFile = Path.Combine (_tempFolder, "default.build");
foreach (string resName in Assembly.GetExecutingAssembly().GetManifestResourceNames()) {
if (!resName.StartsWith("XML_.Build.Files")) {
continue;
}
using (FileStream fs = File.Open (buildFile, FileMode.Create, FileAccess.ReadWrite, FileShare.Read)) {
byte[] buffer = new byte[8192];
Stream rs = Assembly.GetExecutingAssembly().GetManifestResourceStream(resName);
while (true) {
int bytesRead = rs.Read(buffer, 0, buffer.Length);
if (bytesRead == 0) {
break;
}
fs.Write(buffer, 0, bytesRead);
}
}
bool expectSuccess = (resName.IndexOf(".Valid.") > 0);
try {
XmlDocument doc = new XmlDocument();
doc.Load(buildFile);
Project p = new Project(doc, Level.Info, 0);
string output = BuildTestBase.ExecuteProject(p);
Assert.IsTrue (expectSuccess, "#1: " + resName + " " + output);
} catch (Exception ex) {
Assert.IsFalse (expectSuccess, "#2: " +resName + " " + ex.ToString());
}
}
}
示例4: ExpressionEvaluator
/// <summary>
/// Initializes a new instance of the <see cref="ExpressionEvaluator"/> class.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="properties">The projects properties.</param>
/// <param name="state">The state.</param>
/// <param name="visiting">The visiting.</param>
public ExpressionEvaluator(Project project, PropertyDictionary properties, Hashtable state, Stack visiting)
: base(project)
{
_properties = properties;
_state = state;
_visiting = visiting;
}
示例5: SetUp
protected override void SetUp() {
base.SetUp();
_buildFileName = Path.Combine(TempDirName, "test.build");
TempFile.CreateWithContents(FormatBuildFile("", ""), _buildFileName);
_project = new Project(_buildFileName, Level.Info, 0);
_project.Properties["prop1"] = "asdf";
}
示例6: DummyCircularReferenceTask
public DummyCircularReferenceTask(string references, string buildFileXml)
{
m_References = references;
XmlDocument doc = new XmlDocument();
doc.LoadXml(buildFileXml);
Project = new Project(doc, Level.Info, 1);
Project.Execute(); // this loads targets
}
示例7: AsyncProject
public AsyncProject(String logSrcName, Project proj, String target, ManualCloseLogEventQueue q)
{
_logSrcName = logSrcName;
_project = proj;
_target = target;
_thread = null;
_logEventQueue = q;
}
示例8: UseDefaultNamespace
internal static void UseDefaultNamespace(XmlDocument document, Project project)
{
string xmlCopy = document.OuterXml;
xmlCopy = xmlCopy.Replace("xmlns=\"", "disabledxmlns=\"");
string docStart = "<" + document.DocumentElement.Name;
string newDocStart = docStart + " " + GetNamespaceDeclaration(project.Document);
xmlCopy = xmlCopy.Replace(docStart, newDocStart);
document.LoadXml(xmlCopy);
}
示例9: Install
/// <summary>
/// Replaces existing build event handlers with a handler that enqueues
/// build events into this queue
/// </summary>
/// <param name="proj"></param>
public void Install(Project proj, String hideTarget)
{
_hideTarget = hideTarget;
BuildListenerCollection coll = new BuildListenerCollection();
coll.Add(this);
proj.DetachBuildListeners();
proj.AttachBuildListeners(coll);
}
示例10: AddOrOverwriteProperty
/// <summary>
/// Sets a property to a value for a given NAnt project. If the property
/// already exists on the project, the old value will be overwritten with
/// the new value.
/// </summary>
/// <param name="proj">The project on which to set the property.</param>
/// <param name="prop">The name of the property to set.</param>
/// <param name="val">The value to set the property to.</param>
public static void AddOrOverwriteProperty(Project proj, string prop, string val)
{
#region Preconditions
if (proj == null) throw new ArgumentNullException("proj");
if (prop == null) throw new ArgumentNullException("prop");
if (val == null) throw new ArgumentNullException("val");
#endregion
if (proj.Properties.Contains(prop))
proj.Properties.Remove(prop);
proj.Properties.Add(prop, val);
}
示例11: TryExpandingProperty
private static void TryExpandingProperty(Project project, IBuildProperty property)
{
try
{
property.DefaultExpandedValue =
property.ExpandedValue =
project.ExpandProperties(property.Value, new Location("Buildfile"));
}
catch (BuildException)
{
// TODO: Do something with the error message
}
}
示例12: Test_Initialization_DOMBuildFile
public void Test_Initialization_DOMBuildFile() {
XmlDocument doc = new XmlDocument();
doc.LoadXml(FormatBuildFile("", ""));
Project p = new Project(doc, Level.Error, 0);
Assert.IsNotNull(p.Properties["nant.version"], "Property not defined.");
Assert.IsNull(p.Properties["nant.project.buildfile"], "location of buildfile should not exist!");
Assert.IsNotNull(p.Properties["nant.project.basedir"], "nant.project.basedir should not be null");
Assert.AreEqual(TempDirName, p.Properties["nant.project.basedir"]);
Assert.AreEqual("test", p.Properties["nant.project.default"]);
CheckCommon(p);
Assert.AreEqual("The value is " + Boolean.TrueString + ".", p.ExpandProperties("The value is ${task::exists('fail')}.", null));
}
示例13: RunProject
internal void RunProject(String threadName, Project proj, String targetName)
{
ManualCloseLogEventQueue q = new ManualCloseLogEventQueue(threadName);
AsyncProject ap = new AsyncProject(threadName, proj, targetName, q);
_logEventQueueList.Add(q);
_asyncProjects.Add(ap);
ap.Start();
InstallNewAutoCloseEventListener();
if (_serialize) {
ap.WaitForFinish();
}
}
示例14: Test_Initialization_FSBuildFile
public void Test_Initialization_FSBuildFile() {
// create the build file in the temp folder
TempFile.CreateWithContents(FormatBuildFile("", ""), _buildFileName);
Project p = new Project(_buildFileName, Level.Error, 0);
Assert.IsNotNull(p.Properties["nant.version"], "Property ('nant.version') not defined.");
Assert.IsNotNull(p.Properties["nant.location"], "Property ('nant.location') not defined.");
Assert.AreEqual(new Uri(_buildFileName), p.Properties["nant.project.buildfile"]);
Assert.AreEqual(TempDirName, p.Properties["nant.project.basedir"]);
Assert.AreEqual("test", p.Properties["nant.project.default"]);
CheckCommon(p);
Assert.AreEqual("The value is " + Boolean.TrueString + ".", p.ExpandProperties("The value is ${task::exists('fail')}.", null));
}
示例15: TimeSpanFunctions
public TimeSpanFunctions(Project project, PropertyDictionary properties)
: base(project, properties)
{
}