stewarts Posted February 7, 2006 Posted February 7, 2006 --I have an application� --The solution consists of 2 projects --Project 1 properties show output type = Windows Application --Project 2 properties show output type = Class Library --I am able to add a reference to Project-2 within Project-1 (I am showing a form in Project-2 from a form in Project-1) --I am not able to add a reference to Project-1 within Project-2 (Error Msg �A reference to Project-1 could not be added. An assembly must have a �dll� extension in order to be referenced.�) So how can I see public variables in a form in Project-1 from a form in Project-2? This is probably very basic, but I can�t figure it out. Thanks for any help!!!!! Sue Quote
Administrators PlausiblyDamp Posted February 7, 2006 Administrators Posted February 7, 2006 You can do this from the command line rather than using VS however that may be far more work than justifies the end result. Also if Project1 references Project2 you will not be able to then set up a reference from 2 to 1 as this will create a circular dependancy. It may help if you give a little more information about why you are doing it this way... Global variables can introduce problems in the development process and also lead to hard to track down bugs. Would it not be possible to pass the relevant values from Project1 to the Class or Method in Project2 as parameters or via a property rather than relying on globals? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Mister E Posted February 8, 2006 Posted February 8, 2006 If Project 2 is a Class Library then, by definition, it is not made to run by itself. You will need to add a reference to Project 2 (as you have already) done and run Project 2 under Project 1's application domain. You will need to set the dependencies in Project 2 when the application is first loaded. This is the whole point of having a class library. Quote
stewarts Posted February 8, 2006 Author Posted February 8, 2006 Thank you for your replies. I have done what you suggested. I passed the information needed in Form-2 from Form-1 as parameters. It seems to be working so far. Thanks again. Sue Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.