Building GraalVM native image on Windows - cannot uninstall Microsoft Visual C++ 2010 Redistributabl

I’m trying to build a GraalVM native image on Windows for a picocli-based Java app.

Graal (actually SubstrateVM) needs the Microsoft Windows SDK for Windows 7 and .NET Framework 4 as well as the C compilers from KB2519277. I use the following command for this:

choco install -d windows-sdk-7.1 kb2519277

The windows-sdk-7.1 installation fails with “Command [“C:\ProgramData\chocolatey\lib\windows-sdk-7.1\tools\GRMSDK_EN_DVD\setup.exe” -q -params:ADDLOCAL=ALL] exited with ‘1’.”

I suspect this is because a Microsoft Visual C++ 2010 Redistributable already exists on this machine, so I try to remove this with the following PowerShell command:

- name: Uninstall Installed MS VC++ Redistributables
        shell: powershell
        run: |
          $apps = Get-WmiObject -Class Win32_Product -Filter "Name LIKE 'Microsoft Visual C++ 20%% Redistributable%'"
          foreach ($app in $apps) {
            echo $app
            $app.Uninstall()
          }

This gives the following output:

IdentifyingNumber : {DA5E371C-6333-3D8A-93A4-6FD5B20BCC6E}
Name : Microsoft Visual C++ 2010 x64 Redistributable - 10.0.30319
Vendor :
Version : 10.0.30319
Caption : Microsoft Visual C++ 2010 x64 Redistributable - 10.0.30319

__GENUS : 2
__CLASS :__ PARAMETERS
__SUPERCLASS :
__DYNASTY :__ PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 1
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 1612
PSComputerName :

The return value 1612 means “Files required by the installer are not available in the Windows Installer cache.”

Any idea on what could cause this and how to resolve it?

1 Like