.net standard用nuget发布package,依赖无法添加

2020-08-18 17:11发布

问题:

如下是我的.csproj文件, 我使用如下命令想nuget发布package

1.通过命令 nuget setapikey xxxxx-xxxx-xxx-xxxx-xxxx-xxxx , 设置API Key;

2.通过命令 nuget spec 生成xxxx.nuspec文件;

3.通过命令 nuget pack xxxxxx.csproj 生成xxxx.nupkg文件;

4.通过命令 nuget.exe push xxxxx.nupkg -Source https://www.nuget.org ,将NuGet发布到服务器。

但是发布完毕后,没有dependencies, 下载到程序中,因为没有相关依赖,也无法使用,如何解决呢?

<PropertyGroup>
	<TargetFramework>netstandard2.0</TargetFramework>
	<SignAssembly>true</SignAssembly>
	<DelaySign>false</DelaySign>
	<AssemblyOriginatorKeyFile>LazyWeChat.pfx</AssemblyOriginatorKeyFile>
	<Description>it is light wechat framework</Description>
	<PackageId>LazyWeChat</PackageId>
	<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
	<AssemblyVersion>0.0.0.3</AssemblyVersion>
	<FileVersion>0.0.0.3</FileVersion>
	<Version>0.0.3</Version>
</PropertyGroup>

<ItemGroup>
	<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
	<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.1.5" />
	<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="3.1.5" />
	<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.5" />
	<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.1.5" />
	<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.5" />
	<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.1.5" />
	<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
</ItemGroup>

<ItemGroup>
	<ProjectReference Include="..\LazyWeChat.Abstract\LazyWeChat.Abstract.csproj" />
	<ProjectReference Include="..\LazyWeChat.Implementation\LazyWeChat.Implementation.csproj" />
	<ProjectReference Include="..\LazyWeChat.Models\LazyWeChat.Models.csproj" />
	<ProjectReference Include="..\LazyWeChat.Utility\LazyWeChat.Utility.csproj" />
</ItemGroup>

回答1:

把2和3步骤换成dotnet pack xxx.csproj



标签: nuget