Ndoc Part – II
Ndoc with MSBuild
In above script I used NDoc which is provided by MSBuild Community Tasks.
<Project DefaultTargets=“NDoc” xmlns=“http://schemas.microsoft.com/developer/msbuild/2003”>
<Import Project= “$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets”/>
<PropertyGroup>
<BuildDirectory>E:\Project\WorkingDirectory</BuildDirectory>
</PropertyGroup>
<Target Name=“NDoc” >
<MakeDir Directories =“$(BuildDirectory)\Documentation”/>
<NDoc Documenter=“MSDN” ProjectFilePath=“E:\ndoc\myproject.ndoc”
NdocToolPath=“E:\NDoc 1.3.1” />
</Target>
</Project>
We have to install it and use it as shown in above script.
Now here i made a small change in the source code for NDoc task, NdocToolPath looks for the Ndoc exe in “Program files” folder which is not correct we can have the exe anywhere. I've following commented Method GenerateFullPathToTool was replaced by uncommented one.
///
/// Returns the fully qualified path to the executable file.
///
/// The fully qualified path to the executable file.
protected override string GenerateFullPathToTool()
{
return _ndocToolPath + “\\NDocConsole.exe”;
}
//protected override string GenerateFullPathToTool()
//{
// string ndocPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
// ndocPath = Path.Combine(ndocPath, @”NDoc 1.3\bin\net\1.1”);
// try
// {
// using(RegistryKey buildKey = Registry.ClassesRoot.OpenSubKey(@”NDoc Project File\shell\build\command”))
//{
// if (buildKey == null)
// {
// Log.LogError(“Could not find the NDoc Project File build command. Please make sure NDoc is installed.”);
// }
// else
// {
// ndocPath = buildKey.GetValue(null, ndocPath).ToString();
// Regex ndocRegex = new Regex(“(.+)NDocConsole\\.exe”, RegexOptions.IgnoreCase);
// Match pathMatch = ndocRegex.Match(ndocPath);
// ndocPath = pathMatch.Groups[1].Value.Replace(“\”“, ““);
// }
// }
// }
// catch (Exception ex)
// {
// Log.LogErrorFromException(ex);
// }
// base.ToolPath = ndocPath;
// return Path.Combine(ToolPath, ToolName);
//}