Describe the Bug
install-driver.ps1 fails at the Add-Type step with an "incorrect format" assembly load error, immediately after pnputil successfully stages the driver INF. This happens 100% of the time; reproduced on two separate install attempts with a full system reboot and clean driver re-registration in between (first attempt published oem260.inf, second published oem264.inf, same failure both times).
Exact error from C:\ProgramData\libvirtualhid\install-driver.log:
Adding driver package: libvirtualhid.inf
Driver package added successfully.
Published Name: oem264.inf
Total driver packages: 1
Added driver packages: 1
PS>TerminatingError(Add-Type): "Could not load file or assembly '6656 bytes loaded from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. An attempt was made to load a program with an incorrect format."
MSI surfaces this as Error 1722 on action CA_LibVirtualHidInstallDriver. The CA runs as WORKGROUP\SYSTEM via:
"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\libvirtualhid\scripts\windows\install-driver.ps1" -InfPath "...\libvirtualhid.inf" -CertificatePath "...\libvirtualhid-ci-test.cer" -BrokerPath "...\libvirtualhid_broker.exe" -LogPath "C:\ProgramData\libvirtualhid\install-driver.log"
Expected Behavior
install-driver.ps1 should complete the Add-Type call and finish installing/registering the broker without error, resulting in a successful MSI install (no Error 1722) and a working ROOT\LIBVIRTUALHID device.
Additional Context
- Environment: Windows 11 Insider Canary channel, reported OS build 10.0.26200.0; PowerShell 5.1.26100.9278 (Desktop edition), CLR 4.0.30319.42000
- Ruled out: Bitdefender/AV interference (manual scan clean, full AV/ATD/Safe Files exclusions applied with no change), stale install directory (fully removed/recreated C:\Program Files\libvirtualhid\ and C:\ProgramData\libvirtualhid\ before retry), pending-reboot state (reproduced identically after a clean reboot), and driver-store corruption (Windows cleanly re-registered a fresh INF both times)
install-driver.log
Describe the Bug
install-driver.ps1 fails at the Add-Type step with an "incorrect format" assembly load error, immediately after pnputil successfully stages the driver INF. This happens 100% of the time; reproduced on two separate install attempts with a full system reboot and clean driver re-registration in between (first attempt published oem260.inf, second published oem264.inf, same failure both times).
Exact error from C:\ProgramData\libvirtualhid\install-driver.log:
Adding driver package: libvirtualhid.inf
Driver package added successfully.
Published Name: oem264.inf
Total driver packages: 1
Added driver packages: 1
PS>TerminatingError(Add-Type): "Could not load file or assembly '6656 bytes loaded from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. An attempt was made to load a program with an incorrect format."
MSI surfaces this as Error 1722 on action CA_LibVirtualHidInstallDriver. The CA runs as WORKGROUP\SYSTEM via:
"C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\libvirtualhid\scripts\windows\install-driver.ps1" -InfPath "...\libvirtualhid.inf" -CertificatePath "...\libvirtualhid-ci-test.cer" -BrokerPath "...\libvirtualhid_broker.exe" -LogPath "C:\ProgramData\libvirtualhid\install-driver.log"
Expected Behavior
install-driver.ps1 should complete the Add-Type call and finish installing/registering the broker without error, resulting in a successful MSI install (no Error 1722) and a working ROOT\LIBVIRTUALHID device.
Additional Context
install-driver.log