0

I have a NSIS installer that runs a ps1 file to install a bunch of stuff and set up networking configurations.

When it runs the script it installs NuGet into the ProgramFilesx86 and for some reason when i call "Install-Module xNetworking" it cant find it, but if its installed in the ProgramFiles dir it works just fine.

I have the SetRegView 64 option in the nsi file.

Why is NuGet getting installed in the 32-bit directory instead of the 64? Is there an option im missing?

Command to install nuget is just "Install-PackageProvider NuGet -force"

dstew
  • 109
  • 1
  • 9
  • So I found out that NSIS is a 32 bit process which explains my issue, still cant find a workaround. – dstew Jan 07 '20 at 21:16

1 Answers1

0

The File System Redirector will redirect 32-bit applications to the 32-bit Program Files directory on 64-bit Windows.

!include x64.nsh
RequestExecutionLevel Admin

Section
StrCpy $InstDir $ProgramFiles32
${If} ${RunningX64}
StrCpy $InstDir $ProgramFiles64
${EndIf}
${DisableX64FSRedirection}
SetOutPath $InstDir
File NativeThing.ps1
${EnableX64FSRedirection}
SectionEnd

If you are launching powershell from the installer you might have to make sure you are using 64-bit powershell as well.

Anders
  • 97,548
  • 12
  • 110
  • 164