Call powershell script in post-built with parameters

前端 未结 5 780
慢半拍i
慢半拍i 2021-01-05 07:33

I\'m trying to get Powershell to run my PS script in post built - but somehow it doesn\'t work like it\'s supposed to:

Following command in Post-Build:



        
5条回答
  •  伪装坚强ぢ
    2021-01-05 08:15

    add cmd-file (e.g. run-script.cmd) with this content:

    
        @echo off
        set pspath=%windir%\Sysnative\WindowsPowerShell\v1.0
        if not exist %pspath%\powershell.exe set pspath=%windir%\System32\WindowsPowerShell\v1.0
        %pspath%\powershell.exe -ExecutionPolicy RemoteSigned %*
    
    

    and call it from build event in a such manner:

    
        $(SolutionDir)scripts\run-script.cmd $(SolutionDir)scripts\restore-default-file.ps1 -source $(ProjectDir)App_Data\Configs\Mip.Security.Sample.config -destination $(ProjectDir)App_Data\Configs\Mip.Security.config
    
    

提交回复
热议问题