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:
In the _old_ csproj format, the documentation file would be only outputted to the output folder.
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.
Most helpful comment
You can also set
instead of
DocumentationFile. Then the file name and path will be autogenerated.