Tag Archives: clickOnce

Publishing DPI aware .net windows forms applications

In order to indicate that your Windows Forms application is DPI aware, you should set in application manifest something like:

<application xmlns="urn:schemas-microsoft-com:asm.v3">
    <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>

However, once this is inserted in the application manifest, you can still publish your application, but you’ll be unable to install it from the published result.

The fix is quite easy, you’ll have to remove the configuration from application manifest and do it programatically at application startup:

static class Program

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
            if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();

            Application.Run(new MainForm());

        private static extern bool SetProcessDPIAware();

Happy coding!