473,378 Members | 1,527 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

assembly build loops?

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
Feb 27 '06 #1
5 1194

"Doug Kent" <dkent@_n_o_s_p_a_m.austin.rr.com> wrote in message
news:q7*******************@tornado.texas.rr.com...
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)
Feb 27 '06 #2
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*******************@tornado.texas.rr.com...
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)

Feb 28 '06 #3

"Richard MSL" <Ri*************@nospam.nospam> wrote in message
news:25**********************************@microsof t.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*******************@tornado.texas.rr.com...
> 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)

Mar 1 '06 #4
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**********************************@microsof t.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*******************@tornado.texas.rr.com...
> 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)


Mar 1 '06 #5
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


Mar 1 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
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...
0
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...
25
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...
3
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...
5
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...
7
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...
10
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...
11
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...
2
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.