This link How do I create an XML Intellisense file for my DLL? explains how to build your dlls so that an XML file is included containing all your documentation headers so that they are available in those IntelliSense popups.
此链接如何为我的DLL创建XML Intellisense文件?解释了如何构建dll,以便包含包含所有文档头的XML文件,以便它们在这些IntelliSense弹出窗口中可用。
In my company we frequently distribute our own dlls using an internal NuGet package source. When I create NuGet packages for the package source, how do I ensure that someone else gets the dll from the package source, IntelliSense displays the documentation headers for them?
在我的公司,我们经常使用内部NuGet包源分发我们自己的dll。当我为包源创建NuGet包时,如何确保其他人从包源获取dll,IntelliSense会为它们显示文档头?
2 个解决方案
#1
14
If you distribute your xml files with your NuGet package in the same folder as your dlls then Visual Studio will then find these xml files and show intellisense for your assemblies.
如果您将带有NuGet包的xml文件分发到与dll相同的文件夹中,则Visual Studio将找到这些xml文件并显示程序集的intellisense。
To distibute the intellisense xml files you will need to add them to your .nuspec file, for example:
要解析intellisense xml文件,您需要将它们添加到.nuspec文件中,例如:
<files>
<file src="bin\IronPython.dll" target="lib\Net40" />
<file src="bin\IronPython.xml" target="lib\Net40" />
</files>
#2
6
tl;dr documentation files need to be .xml
not .XML
tl; dr文档文件需要是.xml而不是.XML
I was able to get the XML files included by first enabling the production using the Build tab, checking XML Documentation File in the Output section. Note: for some reason I had to manually change the extension from .XML to lowercase .xml. YMMV. This is the same as the question you referenced, How do I create an XML Intellisense file for my DLL?.
我首先使用Build选项卡启用生产,然后在Output部分中检查XML Documentation File,从而获得XML文件。注意:由于某种原因,我不得不手动将扩展名从.XML更改为小写.xml。因人而异。这与您引用的问题相同,如何为我的DLL创建XML Intellisense文件?
Once done, I created the Nuspec file in the project directory. Here's a sample, you can also generate it with nuget spec MyAssembly.dll
- but make sure to edit it and set the values appropriately.
完成后,我在项目目录中创建了Nuspec文件。这是一个示例,您也可以使用nuget spec MyAssembly.dll生成它 - 但请确保编辑它并适当地设置值。
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>1.0.0</version>
<title>Title for your package</title>
<authors>Package Author</authors>
<owners>Package Owner</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A description of your library</description>
<releaseNotes>Release notes for this version.</releaseNotes>
<copyright>Copyright 2013</copyright>
<tags>tag1 tag2</tags>
</metadata>
</package>
Once that was done, I used Nuget to package. Note I had to specify the platform because I'm using a 64-bit OS, but I don't have any targets in the project for x64, only AnyCPU
完成后,我使用Nuget打包。注意我必须指定平台,因为我使用的是64位操作系统,但我在x64项目中没有任何目标,只有AnyCPU
nuget pack MyAssembly.csproj -Prop Configuration=Release;Platform=AnyCPU -build
The assembly and it's associated documentation were automatically included in the package. In addition any packages that you've used in your project are added to the dependency list.
程序集及其相关文档自动包含在程序包中。此外,您在项目中使用的任何包都会添加到依赖项列表中。
See http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package for more information.
有关更多信息,请参见http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package。
#1
14
If you distribute your xml files with your NuGet package in the same folder as your dlls then Visual Studio will then find these xml files and show intellisense for your assemblies.
如果您将带有NuGet包的xml文件分发到与dll相同的文件夹中,则Visual Studio将找到这些xml文件并显示程序集的intellisense。
To distibute the intellisense xml files you will need to add them to your .nuspec file, for example:
要解析intellisense xml文件,您需要将它们添加到.nuspec文件中,例如:
<files>
<file src="bin\IronPython.dll" target="lib\Net40" />
<file src="bin\IronPython.xml" target="lib\Net40" />
</files>
#2
6
tl;dr documentation files need to be .xml
not .XML
tl; dr文档文件需要是.xml而不是.XML
I was able to get the XML files included by first enabling the production using the Build tab, checking XML Documentation File in the Output section. Note: for some reason I had to manually change the extension from .XML to lowercase .xml. YMMV. This is the same as the question you referenced, How do I create an XML Intellisense file for my DLL?.
我首先使用Build选项卡启用生产,然后在Output部分中检查XML Documentation File,从而获得XML文件。注意:由于某种原因,我不得不手动将扩展名从.XML更改为小写.xml。因人而异。这与您引用的问题相同,如何为我的DLL创建XML Intellisense文件?
Once done, I created the Nuspec file in the project directory. Here's a sample, you can also generate it with nuget spec MyAssembly.dll
- but make sure to edit it and set the values appropriately.
完成后,我在项目目录中创建了Nuspec文件。这是一个示例,您也可以使用nuget spec MyAssembly.dll生成它 - 但请确保编辑它并适当地设置值。
<?xml version="1.0"?>
<package >
<metadata>
<id>$id$</id>
<version>1.0.0</version>
<title>Title for your package</title>
<authors>Package Author</authors>
<owners>Package Owner</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A description of your library</description>
<releaseNotes>Release notes for this version.</releaseNotes>
<copyright>Copyright 2013</copyright>
<tags>tag1 tag2</tags>
</metadata>
</package>
Once that was done, I used Nuget to package. Note I had to specify the platform because I'm using a 64-bit OS, but I don't have any targets in the project for x64, only AnyCPU
完成后,我使用Nuget打包。注意我必须指定平台,因为我使用的是64位操作系统,但我在x64项目中没有任何目标,只有AnyCPU
nuget pack MyAssembly.csproj -Prop Configuration=Release;Platform=AnyCPU -build
The assembly and it's associated documentation were automatically included in the package. In addition any packages that you've used in your project are added to the dependency list.
程序集及其相关文档自动包含在程序包中。此外,您在项目中使用的任何包都会添加到依赖项列表中。
See http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package for more information.
有关更多信息,请参见http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package。