如何使用VS2017向NuGet 4.x +包添加文档?

时间:2017-08-23 08:36:41

标签: c# .net nuget visual-studio-2017

我已阅读指南here,但我无法找到如何在build xml文档文件中添加生成的内容。我们过去曾在旧.nuspec个文件<file></file>标记中引用文件,但我无法找到相应的文件。

根据我的理解,似乎如果我在构建时创建xml文件,它应该自动添加到NuGet,但是当我在下载后检查我的nuget时,它仍然没有xml文档。

我做错了什么?

编辑1

  <PropertyGroup>
    <VersionPrefix>1.0.5</VersionPrefix>
    <PackageVersion>1.0.5</PackageVersion>
    <TargetFrameworks>netcoreapp1.1;net461</TargetFrameworks>
    <AssemblyName>SBTech.ApiUtils</AssemblyName>
    <PackageId>SBTech.ApiUtils</PackageId>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <OutputPath>bin\Debug\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|AnyCPU'">
    <OutputPath>bin\Dev\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Staging|AnyCPU'">
    <OutputPath>bin\Staging\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <OutputPath>bin\Release\</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net461|AnyCPU'">
    <DocumentationFile>bin\Debug\net461\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net461|AnyCPU'">
    <DocumentationFile>bin\Release\net461\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Staging|net461|AnyCPU'">
    <DocumentationFile>bin\Staging\net461\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Dev|net461|AnyCPU'">
    <DocumentationFile>bin\Dev\net461\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netcoreapp1.1|AnyCPU'">
    <DocumentationFile>bin\Debug\netcoreapp1.1\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netcoreapp1.1|AnyCPU'">
    <DocumentationFile>bin\Release\netcoreapp1.1\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Staging|netcoreapp1.1|AnyCPU'">
    <DocumentationFile>bin\Staging\netcoreapp1.1\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Dev|netcoreapp1.1|AnyCPU'">
    <DocumentationFile>bin\Dev\netcoreapp1.1\SBTech.ApiUtils.xml</DocumentationFile>
  </PropertyGroup>

这会将xml文件添加到我的包中,但是当我从客户端项目中检查包的代码时,VS中没有显示xml文档。

1 个答案:

答案 0 :(得分:1)

更新到VS 2017版本15.3或更高版本以及.NET Core 2.0.0 SDK(&#34; CLI&#34;) - 或macOS / linux上的mono 5.2 - 这将在{{{}后自动完成1}}设置为生成xml文档(通过csproj属性设置为GenerateDocumentationFile)。

具体来说,NuGet 4.3.0已修复as part of this pull request

相关问题