visual-studiowinformsinstallationsetup-projectdpi-aware

How to setup a WinForms application size when deploying with Visual Studio Installer?


I have a WinForms application, everything works fine when I run it. If I publish with the built-in publish tool, it also works fine. The form is the size I want after installation. built-in publish

However, I want to use the Visual Studio Setup Project to create an installer for it. It can also install successfully, but the problem is that the form is a lot smaller compared to when I install it with the built-in publish tool or when I run it in Visual Studio.

I tried to add the manifest file and config file to the output, but it didn't help. The form is still very small and not the size I specified.

Maybe this is a dumb question but any help would be appreciated, thanks!

Update:

My project framework is .NET Framework 4.8.

I think this is a DPI awareness issue, but I have both the app.manifest and app.config file set up properly. Now the question is how do I make sure the Visual Studio Setup Project deploy my application using the settings I specified in the app.manifest and app.config files? I checked the installed files, there is a config file which is shown below.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
    </startup>
    <System.Windows.Forms.ApplicationConfigurationSection>
        <add key="DpiAwareness" value="PerMonitorV2" />
    </System.Windows.Forms.ApplicationConfigurationSection>
</configuration>

Then maybe it's a problem with the manifest file because I don't see a manifest file in the output folder? In project properties, I've selected app.manifest as my manifest file, but how do I add that to the Deployment project?


Solution

  • Turns out it might be ClickOnce issue. Once I unchecked "Enable ClickOnce security settings" in the Security tab and rebuilt everything, the application looks exactly like I wanted it when I deployed with the Setup Project.