首页 新闻 会员 周边

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

0
悬赏园豆:10 [已解决问题] 解决于 2020-08-18 17:38

如下是我的.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>
LazyWeChat的主页 LazyWeChat | 初学一级 | 园豆:96
提问于:2020-08-18 11:45
< >
分享
最佳答案
0

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

收获园豆:10
Timetombs | 老鸟四级 |园豆:3954 | 2020-08-18 11:54

我使用dotnet pack 指定版本号,打包成功了

再上传到nuget上

但是LazyWeChat.xxx这几个dll是我自己项目里面引用,这些难道要单独传nuget上去吗?

LazyWeChat | 园豆:96 (初学一级) | 2020-08-18 13:32

@dongb83:
两个办法。
1,使用nuspec文件来手动指定你要包含的dll。
2,把这些也上传上去作为一个独立的包。

Timetombs | 园豆:3954 (老鸟四级) | 2020-08-18 14:40

@blackheart: 我现在就是按照独立的package上传上去的了

LazyWeChat | 园豆:96 (初学一级) | 2020-08-18 17:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册