Sorry if this isn't really the proper group to which to post this topic, but
..NET is my development community, and I'm sure a lot of you might have
something to say about this. :-)
Scenario: I have two shared assemblies, each references the other. This
tends to cause build difficulties since DLL 1 needs DLL 2 to build, and DLL
2 needs DLL 1 to build.
I suspect this scenario might reflect a fundamental flaw in the design of
the code, but on the other hand, the design makes perfect sense to me.
Would anyone like to suggest a best practice?
Thanks,
Doug 5 1209
"Doug Kent" <dkent@_n_o_s_p _a_m.austin.rr. com> wrote in message
news:q7******** ***********@tor nado.texas.rr.c om... Sorry if this isn't really the proper group to which to post this topic, but .NET is my development community, and I'm sure a lot of you might have something to say about this. :-)
Scenario: I have two shared assemblies, each references the other. This tends to cause build difficulties since DLL 1 needs DLL 2 to build, and DLL 2 needs DLL 1 to build.
I suspect this scenario might reflect a fundamental flaw in the design of the code, but on the other hand, the design makes perfect sense to me.
Would anyone like to suggest a best practice?
In essence you want something like:
Assembly 1:
public Assembly1Class
{
public IAssembly2 A2;
}
public IAssembly2
{
// stuff from Assembly2Class
}
Assembly 2:
public class Assembly2Class
{
public Assembly1Class A1;
}
Assembly1Class a1 = new Assembly1Class( );
Assembly2Class a2 = new Assembly2Class( );
a1.A2 = a2;
a2.A1 = a1;
This is only the most limited way of breaking the cycle.
You can go further and make both assemblies use interfaces, put the
interfaces in a new assembly 3 and use reflection to construct the instances
so that neither assembly depends on the other (both depend on the interface
assembly that depends on nothing else)
I believe that I have a similar problem to Doug Kent, except that one
assembly is in C++ and the other is in C#. I have been told that there is no
solution. I can not comprehend the proposed solution offered below. Would it
apply to C++ and C# assemblies? Thanks.
"Nick Hounsome" wrote: "Doug Kent" <dkent@_n_o_s_p _a_m.austin.rr. com> wrote in message news:q7******** ***********@tor nado.texas.rr.c om... Sorry if this isn't really the proper group to which to post this topic, but .NET is my development community, and I'm sure a lot of you might have something to say about this. :-)
Scenario: I have two shared assemblies, each references the other. This tends to cause build difficulties since DLL 1 needs DLL 2 to build, and DLL 2 needs DLL 1 to build.
I suspect this scenario might reflect a fundamental flaw in the design of the code, but on the other hand, the design makes perfect sense to me.
Would anyone like to suggest a best practice?
In essence you want something like:
Assembly 1:
public Assembly1Class { public IAssembly2 A2; }
public IAssembly2 { // stuff from Assembly2Class }
Assembly 2:
public class Assembly2Class { public Assembly1Class A1; }
Assembly1Class a1 = new Assembly1Class( ); Assembly2Class a2 = new Assembly2Class( );
a1.A2 = a2; a2.A1 = a1;
This is only the most limited way of breaking the cycle. You can go further and make both assemblies use interfaces, put the interfaces in a new assembly 3 and use reflection to construct the instances so that neither assembly depends on the other (both depend on the interface assembly that depends on nothing else)
"Richard MSL" <Ri************ *@nospam.nospam > wrote in message
news:25******** *************** ***********@mic rosoft.com... I believe that I have a similar problem to Doug Kent, except that one assembly is in C++ and the other is in C#. I have been told that there is no solution. I can not comprehend the proposed solution offered below. Would it apply to C++ and C# assemblies? Thanks.
Give us some sort of idea of what your dependencies are.
I assume that your C++ is managed otherwise it is difficult for it to depend
on C#.
If it is managed you can do exactly the same as in my example.
"Nick Hounsome" wrote:
"Doug Kent" <dkent@_n_o_s_p _a_m.austin.rr. com> wrote in message news:q7******** ***********@tor nado.texas.rr.c om... > Sorry if this isn't really the proper group to which to post this > topic, > but .NET is my development community, and I'm sure a lot of you might > have > something to say about this. :-) > > Scenario: I have two shared assemblies, each references the other. > This > tends to cause build difficulties since DLL 1 needs DLL 2 to build, and > DLL 2 needs DLL 1 to build. > > I suspect this scenario might reflect a fundamental flaw in the design > of > the code, but on the other hand, the design makes perfect sense to me. > > Would anyone like to suggest a best practice?
In essence you want something like:
Assembly 1:
public Assembly1Class { public IAssembly2 A2; }
public IAssembly2 { // stuff from Assembly2Class }
Assembly 2:
public class Assembly2Class { public Assembly1Class A1; }
Assembly1Class a1 = new Assembly1Class( ); Assembly2Class a2 = new Assembly2Class( );
a1.A2 = a2; a2.A1 = a1;
This is only the most limited way of breaking the cycle. You can go further and make both assemblies use interfaces, put the interfaces in a new assembly 3 and use reflection to construct the instances so that neither assembly depends on the other (both depend on the interface assembly that depends on nothing else)
Thanks for the reply. What I have is a legacy application written in C, that
I have written a new GUI for in C#. It worked in .NET 1.1. The C applications
call a GetScreen function, which is a managed C++ wrapper function that calls
the C# function that makes the WinForm and gets the data. The problem is that
some of the fields on the form can trigger the running of C application code,
so the C# has to call back to a C++ function, which calls the C application
code. Which in turn could initiate another GetScreen. I made it work in 1.1
by using my finished exe as the metadata for building the components, but
that will not work in 2.0, and is not a great solution anyway. Now I have to
be able to build the C, C++ and C# that all depend on each other. So it
sounded similar to the problem described here. Thanks in advance for any
suggestions.
"Nick Hounsome" wrote: "Richard MSL" <Ri************ *@nospam.nospam > wrote in message news:25******** *************** ***********@mic rosoft.com...I believe that I have a similar problem to Doug Kent, except that one assembly is in C++ and the other is in C#. I have been told that there is no solution. I can not comprehend the proposed solution offered below. Would it apply to C++ and C# assemblies? Thanks.
Give us some sort of idea of what your dependencies are.
I assume that your C++ is managed otherwise it is difficult for it to depend on C#. If it is managed you can do exactly the same as in my example.
"Nick Hounsome" wrote:
"Doug Kent" <dkent@_n_o_s_p _a_m.austin.rr. com> wrote in message news:q7******** ***********@tor nado.texas.rr.c om... > Sorry if this isn't really the proper group to which to post this > topic, > but .NET is my development community, and I'm sure a lot of you might > have > something to say about this. :-) > > Scenario: I have two shared assemblies, each references the other. > This > tends to cause build difficulties since DLL 1 needs DLL 2 to build, and > DLL 2 needs DLL 1 to build. > > I suspect this scenario might reflect a fundamental flaw in the design > of > the code, but on the other hand, the design makes perfect sense to me. > > Would anyone like to suggest a best practice?
In essence you want something like:
Assembly 1:
public Assembly1Class { public IAssembly2 A2; }
public IAssembly2 { // stuff from Assembly2Class }
Assembly 2:
public class Assembly2Class { public Assembly1Class A1; }
Assembly1Class a1 = new Assembly1Class( ); Assembly2Class a2 = new Assembly2Class( );
a1.A2 = a2; a2.A1 = a1;
This is only the most limited way of breaking the cycle. You can go further and make both assemblies use interfaces, put the interfaces in a new assembly 3 and use reflection to construct the instances so that neither assembly depends on the other (both depend on the interface assembly that depends on nothing else)
Doug,
I'd say a circular assembly reference does more than make compiling
difficult. It makes it impossible. You have worked around the issue
by bootstrapping the build of the first assembly. That's not something
another developer can do from the code you check into the source code
control library.
The best practice is to separate out those classes that are shared
between your two existing assemblies into a third assembly. You may
need to define interfaces in the third assembly that the classes in the
existing assemblies implement.
Brian
Doug Kent wrote: Sorry if this isn't really the proper group to which to post this topic, but .NET is my development community, and I'm sure a lot of you might have something to say about this. :-)
Scenario: I have two shared assemblies, each references the other. This tends to cause build difficulties since DLL 1 needs DLL 2 to build, and DLL 2 needs DLL 1 to build.
I suspect this scenario might reflect a fundamental flaw in the design of the code, but on the other hand, the design makes perfect sense to me.
Would anyone like to suggest a best practice?
Thanks, Doug This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Terence Shek |
last post by:
Is there a way to set the application binding policy so
that it always binds to the latest version of an
assembly? I'm hoping there is a way to avoid updating the
application's binding configuration every time there is
an update to a shared assembly.
|
by: Ken Durden |
last post by:
I'm working on a client-server application where the client is
controlling two devices (aka servers) which both implement the same
interface contract.
We have a set of about 4 assemblies which specify the interfaces and
the data types which flow through the interfaces. Initially, we
thought this would be enough for the client to talk with the server.
In general it is, but when an exception is generated by the server it
fails to...
|
by: Brian Lindahl |
last post by:
I'm using a temporary buffer to transfer some data and would rather
not allocate it on the heap. The problem is that the size of the
buffer is only known upon entry into the function that utilizes it and
I'd rather not waste space or dynamically allocate on the heap (since
it doesn't need to persist). Now I'm planning on utilizing inline
assembly to modify the stack pointer directly to allocate the space I
need.
Here's an example:
|
by: Madhav Desetty |
last post by:
I have a legacy C/C++ header file which I use to set the version for
DLLs thru' the .rc files while compiling legacy DLLs every day. I
update this header file for every build and would like to use the
constants I defined in this header file for the .NET projects
AssemblyInfo.cs file instead of updating the AssemblyInfo.cs for every
build. Below I came up with a strategy to use the legacy header file
but it is not working.
Contents of...
|
by: mekim |
last post by:
Hello....I am trying to System.Reflection.Assembly.GetExecutingAssembly
().GetName
().Version.ToString () ;
to display the version of the app...but it remains static and therefore does
not increment...it's
AssemblyInfo.vb looks like this
| |
by: Steve Richter |
last post by:
I am attempting to use the IBM DB2Connection class in my .aspx web
page.
Using Visual Web Developer 2005 express, I cant figure out how to add a
reference to a project. heck, I cant figure out how to open a project!
so I am trying to use the @assembly directive to point directly to the
assembly .DLL that contains the DB2 namespace:
|
by: jojobar |
last post by:
Hello,
I am trying to use vs.net 2005 to migrate a project originally in vs.net
2003. I started with creation of a "web site", and then created folders for
each component of the site.
I read somewhere that each folder under the "web site" is compiled in
separate assembly. I however, did not find that the "web site" creation in
vs.net 2005 created any AssemblyInfo.cs file.
|
by: Just Me |
last post by:
I have a solution containing many usercontrol projects.
When I wish to reference a usercontrol in another project I can select
either the project or the assembly.
Does it make a difference which one I select?
Thanks
|
by: Diffident |
last post by:
Hello All,
I just finished reading an interesting article by Scott about App Domains:
http://odetocode.com/Articles/305.aspx
Scott, I have a question about the section "Shadow Copies and Restarts". You
talked about "Drain Stopped" and "Shadow Copy" concepts in this article. I
maintain a web application which is in production. Every morning the way we
build the project is using Visual Studio's IDE to use "Build ->
Build<proj-name>"...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |