Standard: DocumentationFile outputs both to project root as in output folder (when only specifying filename)

Created on 28 Dec 2017  路  9Comments  路  Source: dotnet/standard

When specifying only a filename in the DocumentationFile in the csproj, the generated xml documentation file will be outputted to both the root of the project as well as in the output path.

Given following csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>net47;netstandard2.0</TargetFrameworks>
    <DocumentationFile>my_library.xml</DocumentationFile>
  </PropertyGroup>

</Project>

And we have one class in our class libary:

namespace my_library
{
    /// <summary>
    /// Test
    /// </summary>
    public class Test
    {
    }
}

The documentation file is generated in following directories:

  • project-root
  • project-root/bin/$(Configuration)/net47
  • project-root/bin/$(Configuration)/netstandard2.0

In the _old_ csproj format, the documentation file would be only outputted to the output folder.

Most helpful comment

You can also set

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

instead of DocumentationFile. Then the file name and path will be autogenerated.

All 9 comments

Silly me. Now I notice that I was comparing vbproj against csproj. In a vbproj file the documentation-file only contains the filename, while with csproj the path should be specified.

The behaviour is the same as with the _old_ csproj file.

For future reference. I use following DocumentionFile specification to output the file "generically":

<PropertyGroup>
  <DocumentationFile>bin\$(Configuration)\$(TargetFramework)\my_library.xml</DocumentationFile>
</PropertyGroup>

You can also set

<PropertyGroup>
  <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

instead of DocumentationFile. Then the file name and path will be autogenerated.

@dasMulli Visual Studio (15.5.2) doesn't show this property in IntelliSense nor I find any documentation about this property?

Opened https://github.com/Microsoft/msbuild/issues/2828 for it to be added to the IntelliSense xsd

Also opened https://github.com/MicrosoftDocs/visualstudio-docs/issues/407 on the docs repo

On the VS project system side, https://github.com/dotnet/project-system/issues/368 tracks setting this property from the property pages instead of DocumentationFile if the user doesn't wish to override default paths.

@dasMulli Thanks for opening the related issues in the correct repositories.

Nothing was changed since 2017 in VS project properties for .NET Standard Class Library. I mean user interface. Just a lot of discussion.
In case of using .NET Classic, just tick a checkbox. If you choose modern .NET, be ready to dance with a tambourine.

See - https://github.com/dotnet/project-system/issues/368.
I had a look at the code once and i soon realized that i don't have the necessary understanding to work on it.

Was this page helpful?
0 / 5 - 0 ratings