2017-08-23 101 views
0

我读过指南here,但我找不到如何添加我生成的构建XML文档文件。我们曾经参考旧的.nuspec文件<file></file>标签中的文件,但我无法找到它的等价物。如何使用VS2017将文档添加到NuGet 4.x +包?

从我的理解看来,如果我在构建时创建了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文件到我的包,但是当我从客户端项目的XML文档中检查包装的代码是不是在VS.所示

+0

怎么样这个问题?你能从马丁的回答中获得有用的信息吗?我测试它在我身边正常工作。如果它不是你想要的,请分享我们关于这个问题的更多信息。 –

+0

事实上,我的VS是15.2版本,但升级后,问题仍然存在,我正在编辑我的项目文件的问题。 @ Leo-MSFT – kuskmen

回答

1

一旦您更新到VS 2017版本15.3或更高版本以及.NET Core 2.0.0 SDK(“CLI”)或macOS/linux上的mono 5.2,将会在csproj设置为生成xml文档(通过将GenerateDocumentationFile属性设置为true)。

具体而言,这已得到修复as part of this pull request为的NuGet 4.3.0

+0

我编辑了我的问题,我认为我做了一些其他的错误,因为我将我的工作室从15.2更新为15.3,问题仍然存在。 – kuskmen

+0

我测试了它,当我用你的属性创建一个项目时它工作正常。你有没有安装2.0.0 SDK,并确保没有'global.json'设置较低的sdk版本? –

相关问题