> -----Original Message-----
> From: Jody Williams [mailto:[EMAIL PROTECTED]
> Sent: dinsdag 7 maart 2006 19:33
> To: Gert Driesen
> Cc: [email protected]
> Subject: RE: [NAnt-users] C# custom function
>
> The link to the Boolean custom function helped.
>
>
>
> My first problem was that "using NAnt.Core.Types" was not in
> the examples I'd seen so far, and that's where Function and
> FunctionSet are picked up from.
No, these types are in fact in the NAnt.Core.Attributes namespace.
> My second problem was that when I copied my .dll to the nant
> bin directory and tried to call my function from a build file I got:
>
> Unknown function <myfunction>
>
> I had to use <loadtasks . /> to load my custom function
> definition. Is this a bug?
Nope, its not.
1. When starting NAnt, NAnt will load assemblies that match the following
pattern (relative to the NAnt base directory) :
<!-- include NAnt task assemblies -->
<include name="*Tasks.dll" />
<!-- include NAnt test assemblies -->
<include name="*Tests.dll" />
<!-- include framework-neutral assemblies -->
<include name="tasks/*.dll" />
<!-- exclude Microsoft.NET specific task assembly -->
<exclude name="NAnt.MSNetTasks.dll" />
<!-- exclude Microsoft.NET specific test assembly -->
<exclude name="NAnt.MSNet.Tests.dll" />
2. Next, some additional directory are scanned, depending on the runtime
framework on which NAnt is running.
In general, the following pattern applies:
<!-- include assemblies specific to framework family -->
<include name="tasks/<framework family>/*.dll" />
<!-- include assemblies specific to framework version -->
<include name="tasks/<framework family>/<framework version>/**/*.dll"
/>
So, for .NET 1.0 you'd get the following pattern:
<!-- include assemblies specific to framework family -->
<include name="tasks/net/*.dll" />
<!-- include assemblies specific to framework version -->
<include name="tasks/net/1.0/**/*.dll" />
Note:
For all .NET framework versions the following additional patterns
are also added to include a task assembly (and its corresponding test
assembly) which is specific for Microsoft NET:
<!-- include Microsoft.NET specific task assembly -->
<include name="NAnt.MSNetTasks.dll" />
<!-- include Microsoft.NET specific test assembly -->
<include name="NAnt.MSNet.Tests.dll" />
3. Finally, whenever a project is loaded (started) NAnt will scan the
following directories for assemblies that match the *.dll pattern:
<Project Base Directory>\
<Project Base Directory>\<framework family>\
<Project Base Directory>\<framework family>\<framework version>
I'd advise you to create "tasks" subdirectory in the NAnt bin directory and
copy your assembly to that directory.
> I'm executing the function now, so things are much better.
Good to hear.
Gert
>
> ________________________________
>
> From: Gert Driesen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 07, 2006 12:33 AM
> To: Jody Williams; [email protected]
> Subject: Re: [NAnt-users] C# custom function
>
>
>
> Hi Jody,
>
>
>
> I'm not sure where you found that information, but Function
> and FunctionSet have not been replaced.
>
>
>
> For an example, you can always check out the custom functions
> that are part of the NAnt distibution.
>
>
>
> eg.
> http://cvs.sourceforge.net/viewcvs.py/nant/nant/src/NAnt.Core/
> Functions/BooleanFunctions.cs?rev=1.1&view=markup
> <http://cvs.sourceforge.net/viewcvs.py/nant/nant/src/NAnt.Core
> /Functions/BooleanFunctions.cs?rev=1.1&view=markup>
>
>
>
> Here's an example of an inline function that checks whether a
> given assembly is deployed in BizTalk:
>
>
>
> <script language="C#" prefix="biztalk">
> <references basedir="${path::combine(bts.install.dir,
> 'Developer Tools')}">
> <include name="Microsoft.BizTalk.ExplorerOM.dll" />
> </references>
> <imports>
> <import namespace="Microsoft.BizTalk.ExplorerOM" />
> </imports>
> <code>
> <![CDATA[
> [Function("is-assembly-deployed")]
> public bool IsAssemblyDeployed(string server,
> string mgmtDb, string assemblyName) {
> BtsCatalogExplorer ce = new BtsCatalogExplorer();
> ce.ConnectionString = "Integrated Security=SSPI;" +
> "database=" + mgmtDb + ";server=" + server;
> return (ce.Assemblies[assemblyName] != null);
> }
> ]]>
> </code>
> </script>
> <echo message="Deployed:
> ${biztalk::is-assembly-deployed('myServer', 'myDb',
> 'AnAssemblyName')}" />
>
>
>
> Hope this helps,
>
>
>
> Gert
>
>
>
>
>
> ----- Original Message -----
>
> From: "Jody Williams" <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> >
>
> To: <[email protected]
> <mailto:[email protected]> >
>
> Sent: Tuesday, March 07, 2006 3:08 AM
>
> Subject: [NAnt-users] C# custom function
>
>
>
> I've just started using NAnt, and the documentation I've found on
> writing custom functions seems to be out of date. It looks like
> FunctionSet and Function have been replaced. I thought I found the
> correct replacements, but when I try to copy my .dll to the nant
> directory and call the function from a build file, I get the message
> "property <my function set> has not been set".
>
>
>
> Does anyone have a C# example that works with nant-0.85-rc3
> they could
> share? If there are any other instructions for making the custom
> function available to build files, I'd appreciate those, too.
>
>
>
> Thanks,
>
>
>
> Jody
>
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
NAnt-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users