[英]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.