发布包到nuget

开发一个非常Cool的类库

这里我开发了一个LootCode的TreeNode类库
源码地址:https://github.com/huzuohuyou/LeetCode/tree/master/LeetCode.TreeNode

配置元数据

修改项目.csproj文件添加如下内容

<Project Sdk="Microsoft.NET.Sdk">

	<PropertyGroup>
		<TargetFramework>net6.0</TargetFramework>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>
		<!--包名-->
		<PackageId>LeetCode.TreeNode</PackageId>
		<!--版本-->
		<Version>1.0.0</Version>
		<!--作者-->
		<Authors>wuhailong</Authors>
		<!--公司-->
		<Company>personal</Company>
		<!--生成自动构建-->
		<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
	</PropertyGroup>
	
</Project>


发布到nuget

  • 打包dotnet pack 生成nupkg

  • 用 dotnet nuget push 发布
dotnet nuget push LeetCode.TreeNode.1.0.0.nupkg --api-key <你的API key> --source https://api.nuget.org/v3/index.json

管理包

地址:https://www.nuget.org/account/Packages

从nuget安装包

运行后事件

cd bin/Debug
if exist *.nupkg dotnet nuget push *.nupkg --api-key oy2agil73bnrazxeblmqs2msoyoam7cuxh6ysybqn3zuzm --source https://api.nuget.org/v3/index.json  --skip-duplicate
posted @ 2022-05-25 16:29  喜爱糖葫芦  阅读(13)  评论(0编辑  收藏  举报