簡體   English   中英

如何使用VS2017將文檔添加到NuGet 4.x +包中?

[英]How to add documentation to NuGet 4.x+ package using VS2017?

我在這里閱讀了指南,但是找不到如何添加生成的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文檔。

一旦您更新到VS 2017版本15.3或更高版本以及.NET Core 2.0.0 SDK(“ CLI”)-或macOS / linux上的mono 5.2-一旦將csproj設置為生成xml文檔(通過將GenerateDocumentationFile屬性設置為true )。

具體來說,此問題已作為針對NuGet 4.3.0的請求請求的一部分而修復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM