目前,我使用Visual Studio 2012在我的Web项目中配置了一个构建后事件,如下所示:
这基本上调用PowerShell脚本向每个.cs文件添加版权声明.
我想要做的是仅在将Web应用程序发布到远程服务器之前执行此PowerShell脚本.这样做我每次需要调试项目时都不会遇到延迟.你知道有什么方法可以实现吗?
根据Sayed的回答,我定制了一个特定的发布配置文件并添加了这个:
<PipelineDependsOn>
CustomBeforePublish;
$(PipelineDependsOn);
</PipelineDependsOn>
</PropertyGroup>
<Target Name="CustomBeforePublish">
<Message Text="******* CustomBeforePublish *******" Importance="high" />
<Exec Command="powershell.exe -file "$(ProjectDir)\Copyright.ps1"" />
</Target>
Run Code Online (Sandbox Code Playgroud) powershell publish msdeploy post-build-event visual-studio-2012