Access MySettings from other Project in Solution
Is it possible to access the My.Settings of an other DLL referenced in the current Project? I have a Database project in which Settings the ConnectionString is stored. I need access to this Setting in an other Project(for Log-File).
I have helped myself by a class in the Database-Project which has a function getAppSetting:
Public NotInheritable Class Helper Private Sub New() End Sub Public Shared Function getAppSetting(ByVal key As String) As String Dim returnValue As Object = My.Settings(key) If returnValue Is Nothing Then Return String.Empty Else Return returnValue.ToString End If End Function End Class
I can call this function from my other project to get f.e. the ConnectionString.
Have you tried looking at something like the System.Configuration.ConfigurationManager, I know it works for web apps, not sure about database projects.
Then you could get your connection string with a command like: