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?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With