Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a library project that has multiple targets, e.g. in the CSPROJ file it has:

<TargetFrameworks>net40;net46;net461;net462;net47</TargetFrameworks>

If I want XML documentation for all combinations of these target frameworks and Debug and Release configurations I have to select each one in turn in the UI using the Build Configuration Manager and then set it to build XML documentation for that combination and each combination is then listed separately as a PropertyGroup in the CSPROJ with the intended output file for the XML documentation.

Is there a better way?

Posting question and answer because I didn't find this documented anywhere else online

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
303 views
Welcome To Ask or Share your Answers For Others

1 Answer

An easy way is to set the GenerateDocumentationFile property to true. The VS UI want to set the path, the MSBuild targets will set this property to true if the path is set or set a default path if the GenerateDocumentationFile property is true. So you can add this to your csproj file:

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

If you want to set this to true for all your projects to share it, create a file named Directory.Build.props in your solution's directory with the following content and it will be auto-imported into any projects in the directory hierarchy below:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...