简体   繁体   English

多个项目共享相同的代码而没有循环引用

[英]Multiple projects sharing same code without circular reference

I have a C# and F# project. 我有一个C#和F#项目。 Both are supposed to be a service layer code. 两者都应该是服务层代码。 But sometimes, code from both project need to access code in the other project. 但有时,两个项目的代码都需要访问另一个项目中的代码。

Can each project reference the other without any problems? 每个项目都可以毫无问题地引用其他项目吗?

You can't have circular assembly references. 您不能拥有循环装配参考。 This will require refactoring the parts used by both assemblies into a third assembly, which can then be referenced from both. 这将需要将两个程序集使用的部件重构为第三个程序集,然后可以从这两个程序集中引用它们。

You need to create 3d project where you must add references from both and then you can use methods and objects from C# and F# projects together. 您需要创建必须从两者添加引用的3d项目,然后您可以将C#和F#项目中的方法和对象一起使用。

But usually you don't need such cross-reference. 但通常你不需要这样的交叉引用。 That must be an architecture problem. 那一定是架构问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM