Prev: Precreated objects
Next: Copy entire directory
From: midnight on 26 Jun 2010 20:09 I and another girl developer at worI want to to know how to do the following in a C#.NET 3.5 non-web application: 1. I have a delgate in one project and I want to have the delegate be executed from a click event in another project. How do I setup this type of a project refernce? (Note: This is existing code that is not working. Some other programmer wrote it.) 2. I have setup a control that I want to share with several projects within one solution and a copy of different solutions. Thus can you tell me: a. How to compile(build) the custom contol to generate a DLL? b. Once I have the DLL, where do I place in the folders so that various projects can access it? C. What do I do in the .net to solution to add it (be connected) to other parts of the solution? What should I do to include the custom control in other C#.net solutions?
From: Mr. Arnold on 26 Jun 2010 20:48 midnight wrote: > I and another girl developer at worI want to to know how to do the following > in a C#.NET 3.5 non-web application: > 1. I have a delgate in one project and I want to have the delegate be > executed from a click event in another project. How do I setup this type of a > project refernce? By using .Net Remoting over TCP/IP or WCF client/service over TCP, Named Piped or MSMQ and sending a message to the other project to a service in the other project that is listening. In either case Remoting or WCF, one project is the client and the other project is the service. Those are two ways you can communicate between projects in the same solution. > (Note: This is existing code that is not working. Some other programmer > wrote it.) > 2. I have setup a control that I want to share with several projects within > one solution and a copy of different solutions. Thus can you tell me: > a. How to compile(build) the custom contol to generate a DLL? The control would be placed in a classlib project, which is compiled into a DLL. > b. Once I have the DLL, where do I place in the folders so that various > projects can access it? The DLL should be placed in the Bin directory where the exe is located. > C. What do I do in the .net to solution to add it (be connected) to other > parts of the solution? What should I do to include the custom control in > other C#.net solutions? Put the DLL in the Bin directory and set reference to it. But the better option would be to share the project across solutions by it being a project in a given solution and projects that need the project setting 'Project Reference' to the project in the solution. The DLL is placed in the correct spot and all other projects can see it, when using 'Project Reference'. The sharing of the project by other solutions would be accomplished by using a code repoitory like Team Foundation Server or other such code repositories.
From: Peter Duniho on 27 Jun 2010 04:15 midnight wrote: > I and another girl developer at worI want to to know how to do the following > in a C#.NET 3.5 non-web application: > 1. I have a delgate in one project and I want to have the delegate be > executed from a click event in another project. How do I setup this type of a > project refernce? A delegate is an object. You need to pass it to whatever code is handling the Click event handler so that the handler can invoke the delegate. There's nothing in the project references that does anything to provide the delegate instance to the other project. By the way, there is absolutely no need to use any kind of remoting, networking, message passing, etc. As long as the types are visible in the same project (which that itself _is_ related to the project references), passing the delegate object is as simple as just passing the reference to a method, subscribing to an event, etc. > (Note: This is existing code that is not working. Some other programmer > wrote it.) > 2. I have setup a control that I want to share with several projects within > one solution and a copy of different solutions. Thus can you tell me: > a. How to compile(build) the custom contol to generate a DLL? The custom control will be in whatever executable corresponds to the project in which the code is contained. It can be in its own standalone project, or part of some other project, where the project may be in its own solution or part of a larger one. It's all up to how you want to organize your code. > b. Once I have the DLL, where do I place in the folders so that various > projects can access it? If you want to reference the DLL itself, you put it wherever you want, and then use the "Browse" tab in the Add Reference… dialog to find the DLL. If you want to reference the DLL's project, you use the Add/Existing Project… command to include the project in your Solution. Again, the project can be wherever you want it to be. This latter approach can be a convenient way to allow for different targets for projects in the Solution to use different builds of the DLL (e.g. Debug builds use the Debug version of the DLL, etc.). The downside is that you'll find that all projects that depend on the DLL project will wind up having to be rebuilt if any project that depends on the DLL project is cleaned, because cleaning the dependent project will wind up cleaning the DLL project as well. > C. What do I do in the .net to solution to add it (be connected) to other > parts of the solution? Connected in what way? What "connection" to "other parts of the solution" are you trying to achieve? > What should I do to include the custom control in > other C#.net solutions? Just add it as a reference, or add the DLL's project to the Solution, as I described above. Pete
From: midnight on 27 Jun 2010 13:07 1. When looking at a large solution (lots of projects), how can you tell where the custom control code is located at? The custom control will be in whatever executable corresponds to the > project in which the code is contained. It can be in its own standalone > project, or part of some other project, where the project may be in its > own solution or part of a larger one. 2 How can delegate(s) be accessed by code when the reference to a delegate are in different projects? (How to you set this up in the .net solution?) How do you know if the delegates are in the same project or different project? > By the way, there is absolutely no need to use any kind of remoting, > networking, message passing, etc. As long as the types are visible in > the same project (which that itself _is_ related to the project > references), passing the delegate object is as simple as just passing > the reference to a method, subscribing to an event, etc. 3. I want to make certain that all projects within a soltuion can access each other when needed? Basically I want dll's to be accessed when needed between projects. I want all delegates between projects to be accessible. How can you tell if this is setup correctly? > Connected in what way? What "connection" to "other parts of the > solution" are you trying to achieve? "Peter Duniho" wrote: > midnight wrote: > > I and another girl developer at worI want to to know how to do the following > > in a C#.NET 3.5 non-web application: > > 1. I have a delgate in one project and I want to have the delegate be > > executed from a click event in another project. How do I setup this type of a > > project refernce? > > A delegate is an object. You need to pass it to whatever code is > handling the Click event handler so that the handler can invoke the > delegate. > > There's nothing in the project references that does anything to provide > the delegate instance to the other project. > > By the way, there is absolutely no need to use any kind of remoting, > networking, message passing, etc. As long as the types are visible in > the same project (which that itself _is_ related to the project > references), passing the delegate object is as simple as just passing > the reference to a method, subscribing to an event, etc. > > > (Note: This is existing code that is not working. Some other programmer > > wrote it.) > > 2. I have setup a control that I want to share with several projects within > > one solution and a copy of different solutions. Thus can you tell me: > > a. How to compile(build) the custom contol to generate a DLL? > > The custom control will be in whatever executable corresponds to the > project in which the code is contained. It can be in its own standalone > project, or part of some other project, where the project may be in its > own solution or part of a larger one. > > It's all up to how you want to organize your code. > > > b. Once I have the DLL, where do I place in the folders so that various > > projects can access it? > > If you want to reference the DLL itself, you put it wherever you want, > and then use the "Browse" tab in the Add Reference… dialog to find the DLL. > > If you want to reference the DLL's project, you use the Add/Existing > Project… command to include the project in your Solution. Again, the > project can be wherever you want it to be. > > This latter approach can be a convenient way to allow for different > targets for projects in the Solution to use different builds of the DLL > (e.g. Debug builds use the Debug version of the DLL, etc.). The > downside is that you'll find that all projects that depend on the DLL > project will wind up having to be rebuilt if any project that depends on > the DLL project is cleaned, because cleaning the dependent project will > wind up cleaning the DLL project as well. > > > C. What do I do in the .net to solution to add it (be connected) to other > > parts of the solution? > > Connected in what way? What "connection" to "other parts of the > solution" are you trying to achieve? > > > What should I do to include the custom control in > > other C#.net solutions? > > Just add it as a reference, or add the DLL's project to the Solution, as > I described above. > > Pete > . >
From: midnight on 27 Jun 2010 14:02
Here are some more questions: 1. How can you tell if .Net Remoting over TCP/IP or WCF client/service over TCP, Named Piped or MSMQ is being used? Which method is better? > By using .Net Remoting over TCP/IP or WCF client/service over TCP, Named > Piped or MSMQ and sending a message to the other project to a service in > the other project that is listening. > > In either case Remoting or WCF, one project is the client and the other > project is the service. 2. The other person that responded to this e-mail message said the following: "By the way, there is absolutely no need to use any kind of remoting, networking, message passing, etc. As long as the types are visible in the same project (which that itself _is_ related to the project references), passing the delegate object is as simple as just passing the reference to a method, subscribing to an event, etc. ". Thus can you tell me if your way and/or his way are good methods for having different projects communicate with each other in the same solution? "Mr. Arnold" wrote: > midnight wrote: > > I and another girl developer at worI want to to know how to do the following > > in a C#.NET 3.5 non-web application: > > 1. I have a delgate in one project and I want to have the delegate be > > executed from a click event in another project. How do I setup this type of a > > project refernce? > > By using .Net Remoting over TCP/IP or WCF client/service over TCP, Named > Piped or MSMQ and sending a message to the other project to a service in > the other project that is listening. > > In either case Remoting or WCF, one project is the client and the other > project is the service. > > Those are two ways you can communicate between projects in the same > solution. > > > (Note: This is existing code that is not working. Some other programmer > > wrote it.) > > 2. I have setup a control that I want to share with several projects within > > one solution and a copy of different solutions. Thus can you tell me: > > a. How to compile(build) the custom contol to generate a DLL? > > The control would be placed in a classlib project, which is compiled > into a DLL. > > > b. Once I have the DLL, where do I place in the folders so that various > > projects can access it? > > The DLL should be placed in the Bin directory where the exe is located. > > > C. What do I do in the .net to solution to add it (be connected) to other > > parts of the solution? What should I do to include the custom control in > > other C#.net solutions? > > Put the DLL in the Bin directory and set reference to it. > > But the better option would be to share the project across solutions by > it being a project in a given solution and projects that need the > project setting 'Project Reference' to the project in the solution. The > DLL is placed in the correct spot and all other projects can see it, > when using 'Project Reference'. > > The sharing of the project by other solutions would be accomplished by > using a code repoitory like Team Foundation Server or other such code > repositories. > . > |