[Turn] NuGet study notes (2) - use graphical interface pack their own libraries

Above NuGet Study Notes (1) first met NuGet and quick installation comes NuGet relative to our most important function is the ability to build their own NuGet server, for easy sharing of internal libraries update. After installing NuGet expansion, we have been able to easily download libraries through NuGet they need, Let's talk about how to package your project library Published

  Use graphical interface pack their own libraries

  NuGet can use NuGet.exe class library packaged at the command line, you can also use the graphical interface to package, estimated that many of my friends are like me, are not familiar with the command line and some cold, so using a graphical interface in which only about class library package

  1. First, download manager bag  NuGetPackageExplorer , as the name implies, bags manager can be used to create a new class library package, you can also browse the library already created package

  2. After the download is complete, double-click NuGetPackageExplorer.application installation, the installation is complete will generate a NuGet Package Explorer shortcut on the desktop

 

  3. Double-click NuGet Package Explorer start screen appears, select the Create a new package (Ctrl + N) Create a new package

  4. Select the menu  the Edit  >  the Edit the Package the Metadata  (or CTRL + K) edit information bag

  Here you can edit and add information library package library, the program refers to explain some of the more important under the set of fields

  Id: uniquely identifies the package for locating a library, such as executing Install-Package MyPackage MyPackage Id value here is the command line in the bag

  Version: The version number of the library, where the real version number of recommendations and procedures set consistent to avoid confusion

  Dependencies:此类库依赖的程序集,根据实际情况添加依赖类库的Id和版本号,若无留空即可,这里需要注意下填写的依赖类库需要在NuGet服务器上能找到,否则无法完成自动引用添加

  Framework assemblies:依赖的Framework 程序集,根据实际需要选择即可,一般无需设置

  除以上四项以外其他属性根据实际情况修改即可,若自己用不修改也中,不过为了使用方便还是建议把类库描述(Description)填写下

  5. 编辑好包包信息后接下来添加DLL到包包中

  可以选择 右键-->Add Existinng File... 选择dll添加,也可以直接拖拽DLL到 Package contents 窗口,此例选择拖拽方式

  直接拖拽dll到窗口后,会出现提示:是否将 Winista.HtmlParser.dll放到lib 文件夹下,一般我们选择是

  6. DLL添加完成后,快捷键Ctrl + K 修改包包信息Id为Winista.HtmlParser,版本号为1.8.0

  7. 信息修改和dll都添加完毕后,选择File --> Save(或Ctrl + S)将文件进行保存,默认文件名为Id + 版本号.nupkg

  8. 完成保存后如需要发布到网上,选择File--> Publish...(或Ctrl + P)

  默认的发布地址是官网,发布 Key需要到官网去注册一个账号,然后就可以得到,这里不在复述,若无需发布直接关闭即可

  ps:这里没有讲述如何打包项目文件,一般情况下我们自己将项目文件编译成DLL然后使用图形化界面打包即可满足需求,若实际工作需要高度集成完全自动化操作可自行去研究下官方文档http://docs.nuget.org/

  添加DLL默认会添加Lib文件夹,额外的菜单上还有很多.net文件夹,src等文件夹,这些文件夹只是对文件上的一个物理上的划分而已,只是为了帮助我们做好文件分类,没有其他的用途,dll文件可以随便放置,不过为了规范还是建议按照通常习惯来放置。

转载于:http://kb.cnblogs.com/page/143191/

转载于:https://www.cnblogs.com/Snail-Blog/archive/2013/05/30/3108014.html

Guess you like

Origin blog.csdn.net/weixin_33898233/article/details/94086224
Recommended