Update to VS 17.2.2 - The type name 'ApplicationSettingsBase' could not be found in the namespace 'System.Configuration'.

Daniel Parker 46 Reputation points
2022-06-02T00:44:42.667+00:00

I recently updated from a relatively recent version of VS Community 2022 to 17.2.2, and, in a WinUI 3 C# app, started getting an error message in the generated file Settings11.Designer.cs, "The type name 'ApplicationSettingsBase' could not be found in the namespace 'System.Configuration'." I went through the release notes for recent VS releases, but didn't see anything pertaining to configuration settings. Have there been changes to configuration settings? Any suggestions for how to proceed?

Thanks,
Daniel

Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} vote

2 answers

Sort by: Most helpful
  1. Jay Imerman 5 Reputation points
    2023-12-20T18:55:08.23+00:00

    I have a problem with a VB.NET class library I upgraded from .NET 4.8 to .NET Core 8. After that, the error is in the "Settings.Designer.vb" file. That is auto-generated, and contains the following code extract containing the error:

    Can you please advise how to fix? I am not finding any ready answer on the web yet.

    Option Strict On
    Option Explicit On
    
    Namespace My
        
        <Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(),  _
         Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.3.0.0"),  _
         Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>  _
        Partial Friend NotInheritable Class MySettings
            Inherits Global.System.Configuration.ApplicationSettingsBase
    
            Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
      
    ...
    
    1 person found this answer helpful.
    0 comments No comments

  2. Daniel Parker 46 Reputation points
    2022-06-02T12:36:36.22+00:00

    Thanks for replying, I'm using .NET Core, 6. And you're right, it's a missing assembly, re-reading the error message, it actually says that the class ApplicationSettingsBase has been moved to System.Configuration.ConfigurationManager. I'm assuming that happened recently since I last upgraded, I guess I should have read the message more carefully before posting here! After installing System.Configuration.ConfigurationManager, it builds. This issue can be closed.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.