是否可以设置一个带有后期构建事件的.NET项目来执行powershell脚本?我正在使用这个脚本生成一些文件。
我也可以通过它是一个调试或发布构建到脚本。举一个这样的例子就太好了。
发布于 2017-03-13 16:27:10
命令集-ExecutePolicy将临时设置当前会话下的执行策略。如果你在powershell中设置它,并在vs中运行post build命令,你仍然会得到不允许的结果。所以首先设置,然后运行您的ps1脚本,如下所示
powershell -ExecutionPolicy Unrestricted $(ProjectDir)Deploy.ps1 -ProjectDir $(ProjectDir) -TargetPath $(TargetPath)
发布于 2018-08-02 05:29:18
我在post-build even命令中使用了下面的命令:
PowerShell -NoProfile -ExecutionPolicy unrestricted -file $(SolutionDir)AutomationScript\DBAutomationScript.ps1 -target $(SolutionDir)MUFG.SECMOD.Data\SqlScripts -generatedFileName $(SolutionDir)MUFG.SECMOD.Data\SqlScripts\DeploymentDBScript.sql
DBAutomationScript.ps1内容:
param ([string]$target, [string]$generatedFileName)
https://stackoverflow.com/questions/6500320
复制相似问题