简体   繁体   English

ASP.NET 核心 2.2 - 如何从项目引用的程序集中检索 NuGet Package 依赖项

[英]ASP.NET Core 2.2 - How to retreive NuGet Package Dependencies from Assembly that a Project References

I have a project ("Project1") that has a reference to an Assembly that I created in another project ("Project2").我有一个项目(“Project1”),它引用了我在另一个项目(“Project2”)中创建的程序集。

I just added a function to a class in that assembly, but that function required me to add the NuGet package System.Drawing.Common. I just added a function to a class in that assembly, but that function required me to add the NuGet package System.Drawing.Common. Which isn't an issue.这不是问题。

Here's the issue:这是问题:

When I build Project1, it does not bring System.Drawing.Common.DLL to the bin folder.当我构建 Project1 时,它不会将 System.Drawing.Common.DLL 带到 bin 文件夹中。 So, at runtime, when I execute this new function, I get an error stating that it can't find this DLL.因此,在运行时,当我执行这个新的 function 时,我收到一条错误消息,指出它找不到这个 DLL。

Is there a way that I can have Project1 bring along all of the Assembly's dependencies?有没有办法让 Project1 带来所有大会的依赖项? Or do I have to instead add all the same NuGet packages that Project2/Assembly uses to Project1?或者我是否必须将 Project2/Assembly 使用的所有相同 NuGet 包添加到 Project1?

I'd prefer the former.我更喜欢前者。 I'm using ASP.NET Core 2.2 and Visual Studio 2017.我正在使用 ASP.NET Core 2.2 和 Visual Studio 2017。

Thank you.谢谢你。

The build command with .NET Core 2.2 does not bring in the dependencies by default this is for testing only. .NET Core 2.2 的构建命令默认不引入依赖项,这仅用于测试。 If you are wanting all the dependency.dll to be included for deployment you should use the publish command to get all the.dll from your NuGet packages.如果您希望将所有依赖项.dll 包含在部署中,您应该使用发布命令从您的 NuGet 包中获取所有.dll。 There are other switches to include the framework as well so you don't need to install the framework, on the host.还有其他开关也包含框架,因此您无需在主机上安装框架。

As a friendly reminder, Dot Net Core 2.2 support will end on December 23, 2019友情提醒,Dot Net Core 2.2 支持将于 2019 年 12 月 23 日结束

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

相关问题 如何通过CLI在ASP.NET Core项目中安装nuget包 - How to install nuget package in ASP.NET Core project by the CLI 用ASP.NET Core中的NuGet包替换包装的(非NuGet)程序集时遇到问题 - Trouble replacing wrapped (non-NuGet) assembly with NuGet package in ASP.NET Core NuGet package 用于 ASP.NET Core 5 MVC - NuGet package for ASP.NET Core 5 MVC ASP.NET Core 应用程序中 Saxon 的 Nuget 包的引用未得到解析 - References not being resolved for Saxon's Nuget package in ASP.NET Core Application 用ASP.NET Core 2.2恢复nuget包的问题 - Problem with restoring nuget packages with asp.net core 2.2 如何将 XML 文件从 NuGet 包发布到 ASP.NET Core 2.1 应用程序 - How to publish XML files from a NuGet package to an ASP.NET Core 2.1 application 如何在 ASP.NET Core 2.2 中使用来自不同托管项目的共享 SignalR Hub - How to use shared SignalR Hub from different hosted project in ASP.NET Core 2.2 如何在vs2017软件(以及asp.net核心项目)中从nuget查找和使用下载的软件包? - How to find and use downloaded packages from nuget in vs2017 software (and in an asp.net core project)? 如何在ASP.NET Core项目中包含对程序集的引用 - How to include reference to assembly in ASP.NET Core project 如何在 ASP.NET Core 中排除项目依赖项? - How do I exclude project dependencies in ASP.NET Core?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM