---
Order: 30
Title: Examples
Description: Examples for using the CakE.Issues.DocFx addin.
---
The following example will call [DocFx] to generate the documentation and report any warnings from
the build as comments to the Team Foundation Server pull request.

To call [DocFx] from a Cake script you can use the [Cake.DocFx] addin.

```csharp
#addin "Cake.DocFx"
#addin "Cake.Issues"
#addin "Cake.Issues.MsBuild"
#addin "Cake.PullRequests"
#addin "Cake.PullRequests.Tfs"

Task("Build-Documentation").Does(() =>
{
    // Run DocFx.
    var logPath = @"c:\build\docfx.log";
    DocFxBuild(new DocFxBuildSettings()
    {
        LogPath = logPath
    });

    // Report issues to pull request.
    var repoRootFolder = new DirectoryPath(@"c:\repo");
    ReportIssuesToPullRequest(
        DocFxIssuesFromFilePath(
            logPath,
            @"c:\repo\docs"),
        TfsPullRequests(
            new Uri("http://myserver:8080/tfs/defaultcollection/myproject/_git/myrepository"),
            "refs/heads/feature/myfeature",
            TfsAuthenticationNtlm()),
        repoRootFolder);
});
```

[DocFx]: https://dotnet.github.io/docfx/
[Cake.DocFx]: https://www.nuget.org/packages/Cake.DocFx/
---
Order: 30
Title: Examples
Description: Examples for using the Cake.Issues.InspectCode addin.
---
The following example will call [DocFx] to generate the documentation and outputs the number of warnings.

To call [DocFx] from a Cake script you can use the [Cake.DocFx] addin.

```csharp
#addin "Cake.DocFx"
```

To read issues from DocFx log files you need to import the core addin and the DocFx support:

```csharp
#addin "Cake.Issues"
#addin "Cake.Issues.DocFx"
```

We need some global variables:

```csharp
var logPath = @"c:\build\docfx.log";
var repoRootPath = @"c:\repo";
var docRootPath = @"docs";
```

The following task will build the [DocFx] project and write a log file:

```csharp
Task("Build-Documentation").Does(() =>
{
    // Run DocFx.
    DocFxBuild(new DocFxBuildSettings()
    {
        LogPath = logPath
    });
});
```

Finally you can define a task where you call the core addin with the desired issue provider.

```csharp
Task("Analyze-Log")
.IsDependentOn("Build-Documentation")
.Does(() =>
{
    // Read Issues.
    var issues = ReadIssues(
        DocFxIssuesFromFilePath(logPath, docRootPath),
        repoRootPath);

    Information("{0} issues are found.", issues.Count());
});
```

[InspectCode]: https://www.jetbrains.com/help/resharper/InspectCode.html
[Cake.DocFx]: https://www.nuget.org/packages/Cake.DocFx/
Improve DocFx issue provider example
Improve DocFx issue provider example
