Fixed the Windows installer pre-build PowerShell invocation by replacing the bare powershell command with a configurable $(PowerShellPath) call in installer.vcxproj, and added stable flags (-NoProfile -ExecutionPolicy Bypass) to reduce environment-specific failures. This addresses the MSB3073/9009 command-not-found class of error you reported.

Added a PowerShellPath resolution chain in zoitechat.props so builds can use:

    POWERSHELL_EXE override,

    %WINDIR%\System32\WindowsPowerShell\v1.0\powershell.exe when present,

    fallback powershell.exe from PATH.
This commit is contained in:
2026-02-14 17:56:27 -07:00
parent 173d10f336
commit ba892240cb
2 changed files with 4 additions and 2 deletions

View File

@@ -37,8 +37,7 @@
<Command> <Command>
<![CDATA[ <![CDATA[
SET SOLUTIONDIR=$(SolutionDir)..\ SET SOLUTIONDIR=$(SolutionDir)..\
powershell -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\installer\zoitechat.iss.tt" "$(ZoiteChatBin)zoitechat.iss" "$(PowerShellPath)" -NoProfile -ExecutionPolicy Bypass -File "$(SolutionDir)..\win32\version-template.ps1" "$(SolutionDir)..\win32\installer\zoitechat.iss.tt" "$(ZoiteChatBin)zoitechat.iss"
"$(IsccPath)" /dPROJECTDIR="$(ProjectDir)" /dAPPARCH="$(Platform)" "$(ZoiteChatBin)zoitechat.iss"
]]> ]]>
</Command> </Command>
</PreBuildEvent> </PreBuildEvent>

View File

@@ -91,6 +91,9 @@
<ZoiteChatPdb>$(ZoiteChatBuild)\$(PlatformName)\pdb\</ZoiteChatPdb> <ZoiteChatPdb>$(ZoiteChatBuild)\$(PlatformName)\pdb\</ZoiteChatPdb>
<ZoiteChatRel>$(ZoiteChatBuild)\$(PlatformName)\rel\</ZoiteChatRel> <ZoiteChatRel>$(ZoiteChatBuild)\$(PlatformName)\rel\</ZoiteChatRel>
<IsccPath Condition="'$(IsccPath)'=='' and '$(ISCC_EXE)'!=''">$(ISCC_EXE)</IsccPath> <IsccPath Condition="'$(IsccPath)'=='' and '$(ISCC_EXE)'!=''">$(ISCC_EXE)</IsccPath>
<PowerShellPath Condition="'$(PowerShellPath)'=='' and '$(POWERSHELL_EXE)'!=''">$(POWERSHELL_EXE)</PowerShellPath>
<PowerShellPath Condition="'$(PowerShellPath)'=='' and '$(WINDIR)'!='' and Exists('$(WINDIR)\System32\WindowsPowerShell\v1.0\powershell.exe')">$(WINDIR)\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellPath>
<PowerShellPath Condition="'$(PowerShellPath)'==''">powershell.exe</PowerShellPath>
<IsccPath Condition="'$(IsccPath)'=='' and '$(ProgramFiles(x86))'!='' and Exists('$(ProgramFiles(x86))\Inno Setup 5\iscc.exe')">$(ProgramFiles(x86))\Inno Setup 5\iscc.exe</IsccPath> <IsccPath Condition="'$(IsccPath)'=='' and '$(ProgramFiles(x86))'!='' and Exists('$(ProgramFiles(x86))\Inno Setup 5\iscc.exe')">$(ProgramFiles(x86))\Inno Setup 5\iscc.exe</IsccPath>
<IsccPath Condition="'$(IsccPath)'=='' and '$(ProgramFiles(x86))'!='' and Exists('$(ProgramFiles(x86))\Inno Setup 6\iscc.exe')">$(ProgramFiles(x86))\Inno Setup 6\iscc.exe</IsccPath> <IsccPath Condition="'$(IsccPath)'=='' and '$(ProgramFiles(x86))'!='' and Exists('$(ProgramFiles(x86))\Inno Setup 6\iscc.exe')">$(ProgramFiles(x86))\Inno Setup 6\iscc.exe</IsccPath>
<IsccPath Condition="'$(IsccPath)'=='' and '$(ProgramFiles)'!='' and Exists('$(ProgramFiles)\Inno Setup 5\iscc.exe')">$(ProgramFiles)\Inno Setup 5\iscc.exe</IsccPath> <IsccPath Condition="'$(IsccPath)'=='' and '$(ProgramFiles)'!='' and Exists('$(ProgramFiles)\Inno Setup 5\iscc.exe')">$(ProgramFiles)\Inno Setup 5\iscc.exe</IsccPath>