检测到的循环:我可以明确允许循环依赖性吗?

发布于 2025-02-05 01:46:45 字数 260 浏览 1 评论 0原文

我正在使用一个相对较大的C#.NET代码库,该代码库分为许多不同的子项目,最终将其构建为一个应用程序。我最近添加了一些功能,但最终创建了一个循环依赖性:

我的新模块需要访问某些现有功能,从而将其导入。同时,我导入的模块具有访问新模块的某些属性的零件。因此,我有一个循环依赖性,两个项目分别互相进口。

骑手,或更确切地说,编译器会以错误NU1108:检测到的循环投诉。

我认为,这个周期完全可以,我只是无法建立我的项目。我该如何处理这种依赖性?我需要完全重组代码吗?

I'm working with a relatively large C#.NET codebase that is split into many different sub-projects, ultimately building into one single app. I recently added some functionality, but ended up creating a circular dependency:

My new module needs access to some existing functionality, and thus imports it. At the same time, the module I imported has a part which accesses some properties of the new module. As such, I have a circular dependency where two projects import each other respectively.

Rider, or rather the compiler, complains about it with error NU1108: Cycle detected.

In my opinion, that cycle is totally fine, I just can't get my project built. How can I deal with this dependency? Do I need to completely restructure the code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文