The other half of the change: a tool that says it can take the real DPI should get it. This is what a tool author will do, so it is worth walking the path they walk.
Measured at 96 dpi already: the sample tool without the interface comes out UNAWARE; with the interface and a fresh scan it comes out PER_MONITOR_V2. What is not tested is what that looks like at 150% on a tool that has actually been written for it.
The trap, first
XrmToolBox caches what it knows about a tool in Plugins\manifest.json and only rescans an assembly whose version has changed. Adding IDpiAwarePlugin to a tool without a new version leaves the old metadata in place and the tool is still created unaware — silently. It cost me a build cycle to find; a tool author shipping a release will not hit it, but anyone testing locally will.
It is written into the interface's own documentation, and it is the first thing to check if this ticket seems to fail.
Walk the path
cd C:\Users\kk\Code\XrmToolBox
git checkout high-dpi-opt-in
-
Open Plugins\MsCrmTools.SampleTool\Plugin.cs and add the interface to the factory class, not the control:
public class Plugin : PluginBase, INoConnectionRequired, IPayPalPlugin, IDpiAwarePlugin
-
Build, refresh the sandbox, and delete the cached manifest:
& "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" `
XrmToolBox.sln -p:Configuration=Debug -m
$sandbox = "$env:TEMP\xtb-dpi-sandbox"
Copy-Item .\Plugins\MsCrmTools.SampleTool\bin\Debug\MsCrmTools.SampleTool.dll "$sandbox\Plugins\" -Force
Remove-Item "$sandbox\Plugins\manifest.json" -Force
.\XrmToolBox\bin\Debug\XrmToolBox.exe /overridepath:$sandbox
-
Open the sample tool and ask the machine:
C:\Users\kk\Code\xrm-icons\tools\dpi-spike\bin\WindowProbe.exe XrmToolBox
What should be true
Then the real one
Icons (~/Code/xrm-icons) is laid out in the font it is drawn in rather than in pixels, so it is the first tool that can honestly implement this. It is worth opening at 150% with the interface on:
That is the pair this whole scheme is meant to produce: one tool sharp and correct, every other tool exactly as it was.
The other half of the change: a tool that says it can take the real DPI should get it. This is what a tool author will do, so it is worth walking the path they walk.
Measured at 96 dpi already: the sample tool without the interface comes out
UNAWARE; with the interface and a fresh scan it comes outPER_MONITOR_V2. What is not tested is what that looks like at 150% on a tool that has actually been written for it.The trap, first
XrmToolBox caches what it knows about a tool in
Plugins\manifest.jsonand only rescans an assembly whose version has changed. AddingIDpiAwarePluginto a tool without a new version leaves the old metadata in place and the tool is still created unaware — silently. It cost me a build cycle to find; a tool author shipping a release will not hit it, but anyone testing locally will.It is written into the interface's own documentation, and it is the first thing to check if this ticket seems to fail.
Walk the path
Open
Plugins\MsCrmTools.SampleTool\Plugin.csand add the interface to the factory class, not the control:Build, refresh the sandbox, and delete the cached manifest:
Open the sample tool and ask the machine:
What should be true
PER_MONITOR_V2, notUNAWAREmanifest.json, and it goes back toUNAWAREThen the real one
Icons(~/Code/xrm-icons) is laid out in the font it is drawn in rather than in pixels, so it is the first tool that can honestly implement this. It is worth opening at 150% with the interface on:That is the pair this whole scheme is meant to produce: one tool sharp and correct, every other tool exactly as it was.