NSIS安装程序运行PS1脚本。该脚本尝试安装NuGet,但是将其安装在x86程序文件中?

问题描述 投票:0回答:1

我有一个NSIS安装程序,该安装程序运行ps1文件来安装一堆东西并设置网络配置。

[运行脚本时,它会将NuGet安装到ProgramFilesx86中,由于某种原因,当我调用“ Install-Module xNetworking”时,它找不到它,但是如果将其安装在ProgramFiles目录中,它就可以正常工作。

我在nsi文件中具有SetRegView 64选项。

为什么将NuGet安装在32位目录而不是64位目录中?我有没有选择?

安装nuget的命令只是“ Install-PackageProvider NuGet -force”

powershell nuget nsis
1个回答
0
投票

File System Redirector将32位应用程序重定向到64位Windows上的32位Program Files目录。

!include x64.nsh
RequestExecutionLevel Admin

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

如果从安装程序启动Powershell,则可能还需要make sure you are using 64-bit powershell

© www.soinside.com 2019 - 2024. All rights reserved.