How do I access a class from a different project, but the SAME solution ?  
Author Message
roger_27





PostPosted: Visual C# IDE, How do I access a class from a different project, but the SAME solution ? Top

hey, I have a solution in which I made 2 projects, one is a windows service, and one is a windows application... they were originally made separate, but I added the win service to the solution of the windows app. so now I have 2 projects inside a single solution. I really need to access some variables in the windows service, and pass them over to the windows app, how would I do this

I made a public static class in the windows service and I put the variables and values I want in that class, but how do I access them from the windows app

I cant just type in the namespace of the win service in the windows app name because it doesnt see it in the intellisense, and tells me I am missing a reference.... am I missing a step

any ideas



Visual C#3  
 
 
Formerly Known As Eam





PostPosted: Visual C# IDE, How do I access a class from a different project, but the SAME solution ? Top

Add a reference to the project you want to read from (right-click on the project in the Solution Explorer and choose "Add Reference" then check the "Projects" tab).

Make sure you setup the build dependency (right-click the project again and choose "Project Dependencies")

 
 
roger_27





PostPosted: Visual C# IDE, How do I access a class from a different project, but the SAME solution ? Top

excellent.. I can now access the variables in the public static class, and its public static members..... but their values are still their initialized valuees of zero and null!

How would I get them to stay the values that the windows service sets them to be

thanks


 
 
RizwanSharp





PostPosted: Visual C# IDE, How do I access a class from a different project, but the SAME solution ? Top

To passs the objects from one application to another at runtime, You would have to use Remoting. See MSDN or google about Remoting or .Net remoting, It'll tell you how to pass objects across application boundries at runtime.

Best Regards,

Rizwan



 
 
roger_27





PostPosted: Visual C# IDE, How do I access a class from a different project, but the SAME solution ? Top

thanks for that. but all the information I have found so far on .net remoting involves using an object, then a client, and a server, and they go over http and use ports and require IIS configuration. they are using it as an elternative to web services. I dont need all of that.

got any good links that might help


 
 
roger_27





PostPosted: Visual C# IDE, How do I access a class from a different project, but the SAME solution ? Top

I found a sweet url here for nayone else looking to get this working

http://www.eggheadcafe.com/articles/20050831.asp

the middle shared class hardly needed to be modified at all to get it working!