Properties (Settings.Settings) question in Visual Studio 2010

Feb 28 2011 8:00 AM

Hi,

I have 2 projects in my VS 2010 solution (both using C#), and would like to have Application Setting in one project and access it from the other project.  I have been doing some reading on this, and these Properties seem to be specific to a specific project.  However, is there any way of either accessing the property value of one of these projects from a different project? (example below).  Second best to set it in one project and have that value copied across automatically to the same property name on the other project?

I looked at a few different options, and came across property manager, but that appears to be used for C++ only, and as above I am using C#.

In Properties (Settings.Settings) from the main project (Project1):

Name:       Type:      Scope:          Value:

Test1         String      Application    PC1

I can access these easily from any classes in Project1 by using Properties.Settings.Default.Test1 (or Project1.Properties.Settings.Default.Test1).  However, when I try to access this value from classes in the other project (Project2), it won't let me, and says that I need to have this specifically set in the Properties for this second project.  So, I just want some way of accessing this Test1 value from Project2 (something like Project1.Properties.Settings.Default.Test1 from a class in Project2, either using get and set in Program.cs of Project1, or some other way.  Any suggestions on how to do this appreciated, and some code examples would be great.

Thanks.


Answers (3)