首先把自己编译好的包全部准备到一个文件夹 像这样
接下来新建一个文本文档,后缀名叫.nuspec
填写内容
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<!-- 包的唯一标识号,也是包名 -->
<id>Google.Grpc</id>
<!-- 包的版本,当需要解决版本依赖问题的时候需要用到 -->
<version>1.20.0</version>
<!-- 作者 -->
<authors>Pulsar-V,Zhijia Tao</authors>
<!-- 作者标识符,以便于在仓库里找到他们共有的包 -->
<owners>Pulsar-V</owners>
<!-- 项目的地址 -->
<projectUrl>https://github.com/grpc/grpc</projectUrl>
<!-- 许可证书 -->
<license type="expression">Apache-2.0</license>
<!-- Visual Studio 里面需要展示出来的UI图标 -->
<iconUrl>https://grpc.io/img/grpc_inverse.svg</iconUrl>
<!-- 如果为真,用户在安装时需要先接受许可证 -->
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<!-- 有关此版本详细信息 -->
<releaseNotes>Release for windows Grpc</releaseNotes>
<!--
包管理器中看到的描述信息.
-->
<description>CPP Windows 10 x64 plathform Grpc</description>
<!-- 版权信息 -->
<copyright>Copyright ©2016 Contoso Corporation</copyright>
<!-- 库中的标签,可用于标签搜索 -->
<tags>cpp parsing web rpc</tags>
</metadata>
<!-- 第一行,安装包时显示的readme.txt -->
<files>
<file src="readme.txt" target="" />
<!-- 包里面所包含的文件,以及打包以后的路径 -->
<file src=".\x64\lib\**" target="x64\lib" />
<file src=".\x64\include\**" target="x64\include" />
<file src=".\x64\bin\**" target="x64\bin" />
<file src=".\x86\lib\**" target="x86\lib" />
<file src=".\x86\include\**" target="x86\include" />
<file src=".\x86\bin\**" target="x86\bin" />
</files>
</package>
开始打包
nuget pack grpc-1.20.0-v141.nuspec
现在,在档期按目录下面生成了一个叫Google.Grpc.1.20.0.nupkg的包
接下来本地安装我们的包,测试包的可用性
nuget add Google.Grpc.1.20.0.nupkg -Source E:\nuget\packages
可以看到E:\nuget\packages下面新建了一个包ID相关的文件夹,里面包含了我们刚才打包的包
接下来试试安装
nuget install Google.Grpc -Source E:\nuget\packages
备注:%appdata%\NuGet\NuGet.Config(Windows)
和~/.nuget/NuGet/NuGet.Config(Mac/Linux)。
是默认的Nuget源配置路径
查看文件夹
一个没少,安装成功
sources 命令 (NuGet CLI)sources command (NuGet CLI)
(adsbygoogle = window.adsbygoogle || []).push({});