简体   繁体   English

创建包含其他nuget软件包的nuget软件包

[英]Create nuget package that include other nuget package

I have created a .NET Standard project where I installed the version 4.4.4 of the System.ServiceModel.Http nuget package. 我创建了一个.NET Standard项目,在其中安装了System.ServiceModel.Http nuget软件包的4.4.4版本。 This package include also the dll System.ServiceModel.Primitives ... I add image: 该软件包还包括dll System.ServiceModel.Primitives ...我添加了图像:

在此处输入图片说明

I have created a nuget package from my project with the command 我已经使用以下命令从我的项目中创建了一个nuget包

.\nuget.exe pack MyProjectFile.csproj -Build -ExcludeEmptyDirectories -IncludeReferencedProjects -OutputDirectory  MyOutputDir

Now I must install this package in another solution, in a .NET Framework project. 现在,我必须在.NET Framework项目中的另一个解决方案中安装此软件包。 But for some reason when I start the project I obtain this error: 但是由于某些原因,当我启动项目时,出现此错误:

Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.2.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. 无法加载文件或程序集'System.ServiceModel.Primitives,版本= 4.2.0.3,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一。

The versione 4.2.0.3 of the dll System.ServiceModel.Primitives is inside the package version 4.4.4 dll System.ServiceModel.Primitives的versione 4.2.0.3位于软件包版本4.4.4

I have edited my .NET Standard project file in this way: 我以这种方式编辑了.NET Standard项目文件:

<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.4" />
<PackageReference Include="System.ServiceModel.Http" Version="4.4.4" />

But when I install the package in my .NET Project I still receive that error. 但是,当我在.NET Project中安装软件包时,仍然收到该错误。 No external package has been included in my package... What do I miss? 我的包裹中没有包含外部包裹...我想念什么?

Thank you 谢谢

EDIT 编辑

I also expected, when I install my nuget package, a window appear and tell me something like "You need to install also the Package A and the Package B. Continue or not?". 我也希望在安装nuget软件包时出现一个窗口,告诉我“您是否还需要安装软件包A和软件包B。是否继续?”。 Nothing appear instead.... 什么也没有出现。

If you are using .net standard projects, you can use the dotnet CLI instead of nuget.exe. 如果使用的是.net标准项目,则可以使用dotnet CLI代替nuget.exe。 I always found it cleaner and a far lesser process. 我总是发现它更清洁,而且过程更少。 You can use something like this with the dotnet CLI 您可以在dotnet CLI中使用类似的方法

dotnet pack -c release -o MyOutputDir

Here output folder is optional and config would be "debug" by default. 在这里,输出文件夹是可选的,默认情况下config是“调试”的。 I have used this for several nugets and I never have an issue with nuget references. 我已经将其用于多个nuget,而nuget引用从来没有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有多个DLL的nuget包 - nuget package with multiple DLL's 使用相同 NuGet 包的两个不同版本 - Using two different versions of same the NuGet package 使用 NuGet Package Manager 安装 Entity Framework 6 不会创建相关引用。 (我认为) - Installing Entity Framework 6 with NuGet Package Manager does not create the relevant references. (I think) 如何在Visual Studio 2013中访问NuGet程序包管理器? - How to Access the NuGet Package Manager in Visual Studio 2013? NuGet软件包缺少兼容的引用或文件的问题-及其简单的解决方案 - Problem with NuGet package lacking compatible references or files - and its simple solution Nuget Install-Package成功,但没有添加引用到csproj - Nuget Install-Package successful but no reference added to csproj c# nuget 包没有出现在 VS 的引用中 - c# nuget package doesn't show up in references in VS 安装 SQLite NuGet Package 会安装 package 但引用不可用。 VS2019社区 - Installing SQLite NuGet Package installs the package but the reference is not available. VS2019 Community 对两个 nuget 包 C# .net 框架使用不同版本的包 - Use Different version of package for two nuget package C# .net framework 我可以将Kendo UI Grid与Nuget包Telerik.UI.for.AspNet.Core一起使用吗? - can I use Kendo UI Grid with Nuget package Telerik.UI.for.AspNet.Core?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM