Reputation: 7278
I have added a reference of project B
in project A
.
When I try to access project B
from A
, I can use its classes and folders, but what I want is to read a string value called ConnectionString
from its Settings.settings
but I do cannot seem to find it. Shouldn't it be accessible via B.Properties.Settings.Default.ConnectionString
?
Upvotes: 1
Views: 986
Reputation: 7278
Create a common project so that other projects will reference to that. Create its settings file using "add new item". Create your variables. In the Settings.Designer.cs class change the type of the class from internal sealed to public.
Now in every project that you want to refer this to, click on "Add > Existing item..." and choose the Settings.designer
class file. BUT do not just click "Add" button, there is a small arrow on the button, choose "Add as link"
Clean and build your solution. Now you should be able to refer to the settings file variable by accessing
[NamespaceOfOriginalProject].Settings.Default.VariableName
Upvotes: 1