Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing another project's settings file

Is there a way to access the settings file from a different project? For example, I have a solution that contains 2 projects (Lets call them Proj1 and Proj2). I want to access the application settings of Proj2 from Program.cs in Proj1. Is this possible?

like image 710
KrisTrip Avatar asked Mar 30 '10 20:03

KrisTrip


People also ask

How do I access Web config from another project?

The solution I found was to open it as an XDocument and parse it manually: XDocument xdoc = XDocument. Load("Test/Web. config"); var path = xdoc.

How do I run a project in another project in the same solution?

Start and target the executable of project two by traversing up to the solution level then drill down to the second project. Place the following class in the first project (in this case the project name is WindowFormsApp1) then in say a Button click event we will target WindowsFormApp2 the second project.

Where are Visual Studio project settings stored?

settings is located in the My Project folder for Visual Basic projects and in the Properties folder for Visual C# projects. The Project Designer then searches for other settings files in the project's root folder.


1 Answers

The answer if you are using C#:
The very simple answer is to right click on proj2, choose the settings tab. On the top, you will find the access modifier of the settings class is: internal, change it to public. Add a reference to the proj2 in the proj1 in order to see the proj2 Settings class. That's all.

like image 116
Nour El-Dien Avatar answered Oct 08 '22 03:10

Nour El-Dien