简体   繁体   English

如果将摘要添加为参考,则摘要不会显示在程序集中

[英]Summary is not showing in the assembly if it is added as a reference

I've created a 'Class Library' in C#, which has many functions with summary (XML documentation comments).我在 C# 中创建了一个“类库”,它有很多功能和摘要(XML 文档注释)。

For example例如

///<summary>
///Adds the two numbres
///</summary>
public void Add()
{
    //statements
}

if i use the function in the same namespace, its showing the summary, but if i added it as reference in some ohter workspace(solution) its not showing the summary.如果我在同一个命名空间中使用 function,它会显示摘要,但如果我将它添加为某些其他工作区(解决方案)中的参考,它不会显示摘要。

How to make it visible i other solutions if a added it as a reference, and wat may be the reason for this?如果将其添加为参考,如何使其在其他解决方案中可见,这可能是什么原因?

  1. Go to the solution explorer of your source code. 转到源代码的解决方案资源管理器。 Right click on the project name and go the properties . 右键单击项目名称并转到属性
  2. go to the Build tab if you are using c# and select the check box Xml documentation file . 如果您使用的是c#,请转到Build选项卡,然后选中复选框Xml文档文件
  3. When you build your source code the Xml file will be generated in the location where your dll is present. 构建源代码时,将在dll所在的位置生成Xml文件。
  4. while copy your dll to the solution copy the xml file and paste into the bin of your destination solution. 将dll复制到解决方案时复制xml文件并粘贴到目标解决方案的bin中。

You need to generate XML documentation for the assembly (a file named myassembly.xml) and copy it alongside your .dll where it's referenced by your other projects. 您需要为程序集生成XML文档(名为myassembly.xml的文件),并将其与.dll一起复制,并由其他项目引用。 See this page in MSDN for instructions. 有关说明,请参阅MSDN中的此页面

  1. Go to the solution explorer of your source code. Go 到您的源代码的解决方案资源管理器。 Right click on the project name and go the properties .右键单击项目名称和 go属性
  2. Go to the Build tab if you are using c# and select the check box documentation file .如果您正在使用 Go 到Build选项卡 c# 和 select 复选框文档文件
  3. XML file will be generated within your DLL. 3-1. XML 文件将在您的 DLL 内生成。 3-1. You can define optional path for your generated XML.您可以为生成的 XML 定义可选路径。
  4. Copy XML file with your DLL into folder that you are using DLL.将带有 DLL 的 XML 文件复制到您正在使用 DLL 的文件夹中。

First and second step copied from @PushParaj's answer.从@PushParaj 的回答中复制的第一步和第二步。 Thanks.谢谢。 在此处输入图像描述

When you compile classes that have xml comment, normally a .xml file is created. 编译具有xml注释的类时,通常会创建.xml文件。 (check the options in Visual Studio) (检查Visual Studio中的选项)

When you add a reference to such an assembly, make sure the XML file is present. 添加对此类程序集的引用时,请确保XML文件存在。 The documentation is not contained within the assembly but within the xml file. 文档不包含在程序集中,而是包含在xml文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 程序集引用未与自定义nuget包一起添加 - Assembly reference not being added with custom nuget package MSBuild:删除对通过 NuGet 添加的程序集的引用 - MSBuild: Remove Reference to Assembly added via NuGet 添加了 SharpFont nuget 但未找到对程序集的引用 - SharpFont nuget added but reference to Assembly not found System.Core 未添加到对程序集的引用 - System.Core not added to reference to assembly OSIsoft AF SDK 缺少程序集或参考也添加了参考 - OSIsoft AF SDK Missing assembly or reference also the reference is added SQL Server程序集未显示在“添加引用”对话框中 - SQL Server Assembly Not Showing in “Add Reference” Dialog 例外:不能将对更高版本或不兼容程序集的引用添加到项目中 - Exception : A reference to a higher version or incompatible assembly cannot be added to the project 错误:无法将对更高程序集或不兼容的引用添加到项目中 - Error : A reference to a higher assembly or incompatible can't be added to the project 不能将对更高版本或不兼容程序集的引用添加到项目中 - A reference to a higher version or incompatible assembly cannot be added to the project 添加了对System.Data.SQlite.Linq的引用,仍然会得到程序集引用丢失的错误 - Added reference to System.Data.SQlite.Linq, still get assembly reference missing error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM