c# - 是否可以将 nuget 包添加为仅运行时依赖项?
问题描述
我正在处理以下项目:
MyFramework.csproj(类库)
MyCustomerApp.csproj(类库)
参考 MyFramework
MyLauncher.csproj(可执行程序)
参考 MyLauncherDependency.nupkg
MyCustomerApp.csproj 是“可运行”项目,其工作方式如下:
- MyLauncher.exe 从 MyLauncher 项目复制到 MyCustomerApp 的输出
- 运行 MyLauncher.exe 时,它
Assembly.Load(..)
用于加载 MyCystomerApp.dll
有一个具体的原因说明为什么我们有这个我不会涉及的机制 - 现在认为它超出了范围。
现在问题来了;MyLauncherDependency 是 MyLauncher 的依赖项,但不是 MyCustomerApp 的依赖项。因此 MyLauncherDependency 不是 MyCustomerApp 的编译时依赖项 - 但它是运行时依赖项 - 因为它在运行时需要 MyLauncherDependency.dll。
我不想将 MyLauncherDependency.nupkg 添加到 MyCustomerApp,因为我不想让工程师从 MyCustomerApp 中的 MyLauncherDependency 访问类。
所以我的问题是:如何将 MyLauncherDependency.nupkg(或 MyLauncherDependency.nupkg)添加到 MyCustomerApp 作为仅运行时依赖项?
解决方案
推荐阅读
- javascript - Mongoose Pagination - 在第一次查询时限制为 1,然后在后续查询中限制为 10
- javascript - 如何存储json下拉列表中的项目
- objective-c - 屏幕锁定时如何将数据发送到隐藏设备
- javascript - 使用参数时Nodejs中的类不返回预期值
- flutter - 如何在飞镖中制作超级构造函数
- c++ - 一起使用 new 和 & 符号
- java - PDF 垂直剪切并合并
- swiftui - SwiftUI - 开始/结束外观转换的不平衡调用
- reactjs - React Native Deck Swiper
- go - 在 Windows 中用另一个版本替换 go-swagger