【发布时间】:2012-10-16 03:43:54
【问题描述】:
目前,我使用 Visual Studio 2012 在我的 Web 项目中配置了一个构建后事件,如下所示:
这基本上调用PowerShell script 为每个.cs 文件添加版权声明。
我想做的是仅在将网络应用发布到远程服务器之前执行这个powershell脚本。这样做我不会在每次需要调试项目时遇到延迟。你知道有什么方法可以做到吗?
根据Sayed's answer,我自定义了一个特定的发布配置文件并添加了这个:
<PipelineDependsOn>
CustomBeforePublish;
$(PipelineDependsOn);
</PipelineDependsOn>
</PropertyGroup>
<Target Name="CustomBeforePublish">
<Message Text="******* CustomBeforePublish *******" Importance="high" />
<Exec Command="powershell.exe -file "$(ProjectDir)\Copyright.ps1"" />
</Target>
【问题讨论】:
-
抱歉,除了 pubxml 中已经存在的属性组之外,您是否添加了一个新的属性组?
标签: powershell visual-studio-2012 publish msdeploy post-build-event