I'm having an odd issue with Visual Studio 2019:
- Created a new project (vb.net console application / .NET 5.0)
- Goto > Project Properties
- The Settings Tab is missing (see picture)
- Manually create settings file (settings.settings)
- Add some application scoped settings
- Unable to access settings from within the program using
my.settings.variable_name
- Can access the setting using
project_name.settings.variable_name
but getting a non-shared member requires object refrence error.
Is something hosed with my VS install? (I have 2017 as well, not having this issue)
settings.designer.vb:
Namespace HL7_Pent
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")> _
Partial Friend NotInheritable Class Settings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As Settings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()),Settings)
Public Shared ReadOnly Property [Default]() As Settings
Get
Return defaultInstance
End Get
End Property
<Global.System.Configuration.ApplicationScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property LastRun() As Date
Get
Return CType(Me("LastRun"),Date)
End Get
End Property
End Class
End Namespace
Program.vb:
Sub Main(ByVal args As String())
Dim LastRun = HL7_Pent.Settings.LastRun
End Sub
Error:
Reference to a non-shared member requies and object reference