2

I am trying to leverage the new High DPI support using .net 4.8 in a WinForms app and adding in the section below to the app.config causes a number of things to fail. AppSettings, new SQLConnection, etc..

<system.windows.forms.applicationconfigurationsection>
   <add key="DpiAwareness" value="PerMonitorV2"/>
   <add key="EnableWindowsFormsHighDpiAutoResizing" value="true"/>
</system.windows.forms.applicationconfigurationsection>

I followed the information from this page https://learn.microsoft.com/en-us/dotnet/desktop/winforms/high-dpi-support-in-windows-forms?view=netframeworkdesktop-4.8 and I am still getting the same errors. The DPI functionality works perfectly though.

**ConfigurationErrorsException: Unrecognized configuration section system.windows.forms.applicationconfigurationsection. **

I also copied what was on the page and it fails and the DPI functionality doesn't work.

 <System.Windows.Forms.ApplicationConfigurationSection>
    <add key="DpiAwareness" value="PerMonitorV2" />
  </System.Windows.Forms.ApplicationConfigurationSection>

Any ideas on what I can try? This application was initially written in .net 4.0 I believe. I migrated to .net 4.8 when I upgraded to Visual Studio 2022.

Thanks.

1
  • Where on earth does "doesn't work" show in my question? I specifically identified the error (see above). I also tried it using both what was on the Microsoft page and how Visual Studio 2022 intellisense actually allowed me to type the lower case version. When I say it fails note what I mentioned Commented Jul 20, 2023 at 13:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.