From: Gert D. <ger...@pa...> - 2004-10-28 18:55:27
|
Hi Byrd, Just use this : Log(Level.Info, "Test"); Also, you don't need to take care of the log prefix yourself. The default NAnt logger does this for you. Hope this helps, Gert ________________________________ From: nan...@li... [mailto:nan...@li...] On Behalf Of Byrd, Payton Sent: donderdag 28 oktober 2004 17:50 To: 'Nant-Users@Lists. Sourceforge. Net (nan...@li...)' Subject: [Nant-users] Problem compiling Task I'm new to NAnt... completely. And to make it work in our environment I need to be able to create publisher policy files on the fly after a compile. To do that I'm creating a new Task. I'm having problems using the Log method, however. Can someone please look at the error and the code and tell me what I'm doing wrong? I'm compiling in VS.Net 2002. Thanks in advance! Here's my compile output and code: ------ Rebuild All started: Project: NAntTasks, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... d:\ebusiness\utilities\nanttasks\publisherpolicyfiles.cs(63,6): error CS0119: 'NAnt.Core.Element.Log(NAnt.Core.Level, string)' denotes a 'method' which is not valid in the given context Build complete -- 1 errors, 0 warnings Building satellite assemblies... Satellite assemblies could not be built because the main project output is missing. ---------------------- Done ---------------------- using System; using System.IO; using System.Reflection; using System.Xml; using NAnt.Core; using NAnt.Core.Types; using NAnt.Core.Tasks; using NAnt.Core.Attributes; namespace EBusiness.Utilities.NAntTasks { /// <summary> /// Summary description for PublisherPolicyFiles. /// </summary> [TaskName("PublisherPolicyFile")] public class PublisherPolicyFiles : Task { private const string STR_LOG_PREFIX = "[PublishPolicyFile]"; private string m_strAssemblyName = string.Empty; private bool m_blnTargetAllVersions = true; private OptionCollection m_objVersionsOptionCollection = new OptionCollection(); [TaskAttribute("Assembly")] public string AssemblyName { get { return m_strAssemblyName; } set { m_strAssemblyName = value; } } [TaskAttribute("TargetAllVersions")] public string TargetAllVersions { get { return m_blnTargetAllVersions.ToString(); } set { m_blnTargetAllVersions = Convert.ToBoolean(value); } } /// <summary> /// List of versions to bind to the current version. /// </summary> [BuildElementCollection("VersionsToBind", "Version")] public OptionCollection VersionsTobind { get { return m_objVersionsOptionCollection; } } protected override void ExecuteTask() { if(m_blnTargetAllVersions) { m_objVersionsOptionCollection.Clear(); // Calculate prior Major-Minor versions. } if(m_objVersionsOptionCollection.Count > 0) { } else { if(this.Verbose) { Log.WriteLine("{0}Test", STR_LOG_PREFIX); } } } } } Payton Byrd Trane eBusiness QED Team Phone: 931-905-5386 Fax: 931-648-5901 |