我认为,将C#生成的XML文档文件与DLL一起包含在NuGet包中,以为消费者提供智能感知文档,通常是一种好习惯.
I consider it generally good practice to include the XML documentation file generated by the C# build in NuGet packages alongside the DLLs to provide intellisense documentation for consumers.
但是,我不清楚使用VS 2017的项目文件格式构建软件包时如何做到这一点.
However, it's not clear to me how this can be done when building a package using VS 2017's project file format.
这可能吗?
很明显,我可以切换到维护nuspec文件,但是VS2017格式对于将版本和依赖项全部保存在一个地方非常方便.
Obviously I could switch over to maintaining a nuspec file but the VS2017 format is very convenient for keeping versions and dependencies all in one place.
推荐答案只要您在csproj文件中设置GenerateDocumentationFile就像这样:
As long as you set GenerateDocumentationFile in your csproj file like this:
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netstandard2.0</TargetFramework> <GenerateDocumentationFile>true</GenerateDocumentationFile> </PropertyGroup> </Project>然后所有默认设置都会在正确的位置生成文档文件,并将其包含在NuGet软件包中.
then all the defaults will generate the documentation file at the correct location and it will be included in the NuGet package.
如果Visual Studio添加了DocumentationFile或其他元素,则可以删除它们并将其替换为单个GenerateDocumentationFile属性.
If Visual Studio added DocumentationFile or other elements, you can delete them and replace it with the single GenerateDocumentationFile property.
更多推荐
如何在从项目文件构建的NuGet包中包含XML文档文件?
发布评论