[英]How to deploy C# DLL of hidden NuGet dependency automatically when mixing .Net Standard and .Net Framework?
I have a Visual Studio (2017) C# solution which is structured like this:我有一个 Visual Studio (2017) C# 解决方案,其结构如下:
Stateless
package ("Stateless" is the name of the package) Stateless
包(“Stateless”是包的名称) The DLLProject hides the dependency within its interfaces, ie the usage of the Stateless
library is supposed to be an implementation detail of DLLProject
. DLLProject 在其接口中隐藏了依赖关系,即
Stateless
库的使用应该是DLLProject
的实现细节。
The ExeProject
accesses only the public interfaces and factories of DLLProject
.该
ExeProject
只能访问公共接口和工厂DLLProject
。
Due to reasons which go beyond the scope of this question, ExeProject
targets .Net Framework 4.6.1
, while DLLProject
targets .Net Standard 2.0
.由于超出此问题范围的原因,
ExeProject
以.Net Framework 4.6.1
DLLProject
目标,而DLLProject
以.Net Standard 2.0
目标。
This compiles fine, but when debugging, the Stateless.dll
is not found by the executable.这编译得很好,但是在调试时,可执行文件找不到
Stateless.dll
。
Is it possible to automatically deploy that DLL when linking against DLLProject
without adding a Stateless
NuGet dependency to the ExeProject
?是否可以在链接
DLLProject
时自动部署该 DLL,而不向DLLProject
添加Stateless
NuGet 依赖ExeProject
?
In .NET Core this transitive NuGet dependencies work automatically.在 .NET Core 中,这种可传递的 NuGet 依赖项会自动工作。
On .NET Framework, there is a "Copy Local" option for referenced libraries.在 .NET Framework 上,引用的库有一个“复制本地”选项。 Make sure that it is set to True for the problematic one.
确保将有问题的设置为 True。
Update更新
For your case, .NET Framework App and .NET Standard lib, the setup requires manual modification of the .NET Framework app's .csproj file.对于 .NET Framework 应用程序和 .NET Standard 库,安装程序需要手动修改 .NET Framework 应用程序的 .csproj 文件。 Please follow: Copy all dependencies from .Net Standard libraries to .Net Framework Console application
请遵循: 将所有依赖项从 .Net Standard 库复制到 .Net Framework Console 应用程序
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.