NAnt SDK Documentation - v0.92

NAntFunctions.ScanProbingPaths Method (String, String)

Searches the probing paths of the current target framework for the specified file.

[Visual Basic]
<Function(Name:="scan-probing-paths"), _  EditorBrowsable(State:=EditorBrowsableState.Never)>
Overloads Public Function ScanProbingPaths( _
   ByVal baseDirectory As String, _
   ByVal fileName As String _
) As String
[C#]
[Function(Name="scan-probing-paths")]
[EditorBrowsable(State=EditorBrowsableState.Never)]
public string ScanProbingPaths(
   string baseDirectory,
   string fileName
);

Parameters

baseDirectory
The directory to use a base directory for the probing paths.
fileName
The name of the file to search for.

Return Value

The absolute path to fileName if found in one of the configured probing; otherwise, an error is reported.

Remarks

The (relative) probing paths are resolved relative to the specified base directory.

The configured probing paths are scanned recursively in the order in which they are defined in the framework configuration.

The file name to search should include the extension.

Exceptions

Exception TypeCondition
FileNotFoundExceptionfileName could not be found in the configured probing paths.

Example

Compile an assembly referencing the nunit.framework assembly for the current target framework that is shipped as part of the NAnt distribution.

    
<csc target="library" output="NAnt.Core.Tests.dll">
    <sources basedir="NAnt.Core">
        <include name="**/*.cs" />
    </sources>
    <references>
        <include name="NAnt.Core.dll" />
        <include name="${framework::get-lib-path('nunit.framework.dll')}" />
    </references>
</csc>
    
  

See Also

NAntFunctions Class | NAnt.Core.Functions Namespace | NAntFunctions.ScanProbingPaths Overload List