如下是我的.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>
把2和3步骤换成dotnet pack xxx.csproj
我使用dotnet pack 指定版本号,打包成功了
再上传到nuget上
但是LazyWeChat.xxx这几个dll是我自己项目里面引用,这些难道要单独传nuget上去吗?
@dongb83:
两个办法。
1,使用nuspec文件来手动指定你要包含的dll。
2,把这些也上传上去作为一个独立的包。
@blackheart: 我现在就是按照独立的package上传上去的了