pubxml Web发布工具事件生命周期 [英] pubxml web publish tool Event Lifecycle

查看:209
本文介绍了pubxml Web发布工具事件生命周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Visual Studio 2012中的Web发布工具将其发布到文件系统.我了解到可以在Properties文件夹中打开* .pubxml来执行更多高级操作.

I am using the Web publishing tool from Visual Studio 2012 to publish to File System. I learned that I can open my *.pubxml in the Properties folder to do more advanced things.

我想做的是在发布任务结束时运行一个命令行应用程序. 我通常会在自定义目标"中执行此操作,并在此类事件中的其中一个构建后执行它.

What I want to do is run a command line application at the end of the publishing task. I would usually do it in a Custom Target and execute it after one of the build in Events like this.

 <Target Name="CustomAfterPublish" AfterTargets="GatherAllFilesToPublish">
 </Target>

问题在于GatherAllFilesToPublish是早期的出路,因为我想在完成发布后最后执行它. 是否有列表,或者有人知道事件的构建以及激发事件的顺序?基本上是FileSystem网站发布的事件生命周期.

The problem is that GatherAllFilesToPublish is way to early because I want to execute it at the very last, after publishing was done. Is there a list or does someone know the build in events and there order in which they are fired? Basically the Event Lifecycle of a FileSystem web publish.

或者我该如何在最后手动发射目标?

Or how can I fire a Target manually at the very end?

我尝试了以下操作,但没有成功:

I tried following without success:

<Target Name="Msg" AfterTargets="PipelineDeployPhase;MSDeployPublish;Package">

还有每个单独的. 那么,发布生命周期的最后一个钩子是什么?

And also every each of them individually. So what's the very last hook of the publishing lifecycle?

--->已编辑 我已经添加了跟踪.问题在于,文件已复制到临时路径,然后删除了所有文件.因此,"GatherAllFilesToPublish"在此处从命令行窗口中查看我的跟踪记录后,复制到目标将不起作用...

---> Edited I added already tracing. The problem is that the files were copied to a temp path and after that all files are deleted. So copying to the destination will not work after "GatherAllFilesToPublish"See my trace from the command line window here...

1>------ Build started: Project: Dependency of a project: Release Any CPU ------
2>------ Build started: Project: Dependency of another project, Configuration: Release Any CPU ------


3>------ Build started: Project: Web, Configuration: Release Any CPU ------
4>------ Publish started: Project: Web, Configuration: Release Any CPU ------
4>Transformed Web.config using C:\...\Web.Release.config into obj\Release\TransformWebConfig\transformed\Web.config.
4>Copying all files to temporary location below for package/publish:
4>obj\Release\Package\PackageTmp.

**<------------- Here is the place where my excutable is called ---------------------------------**


4>Deleting existing files...
4>Publishing folder /...
4>Publishing folder App_Browsers...
4>Publishing folder App_Themes...
4>Publishing folder bin...

4>Site was published successfully file:///C:/Test
4>
========== Build: 3 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========
========== Publish: 1 succeeded, 0 failed, 0 skipped ==========

感谢您的帮助.

推荐答案

据我所知,GatherAllFilesToPublish是最后可用的事件.但是,根据您的要求,您仍然可以使用此事件.

As far as I can tell GatherAllFilesToPublish is the last event available. However, depending on your requirements you may still be able to use this event.

您可以将写入中间位置的中间文件作为目标,而不是对最终发布位置中的文件进行操作(显然,ProjectDir是您项目的文件夹)

Instead of performing operations on files in the final publish location, you can target the intermediate files written to the location below (where ProjectDir is the folder of your project obviously)

/ProjectDir/obj/Release/Package/PackageTmp/

/ProjectDir/obj/Release/Package/PackageTmp/

似乎Visual Studio会直接复制此目录中的所有文件.因此,当挂入GatherAllFilesToPublish时,您应该能够对该目录中的文件进行任何更改,它们将反映在最终的发布位置.

It seems that Visual Studio does a straight copy of all files in this directory. So, when hooking into GatherAllFilesToPublish you should be able to make any changes to the files in this directory and they will be reflected in the final publish location.

相关信息

如果您想确认GatherAllFilesToPublish确实是最后一个事件,则可以通过启用Diagnostic build输出来自己完成.

If you'd like to verify that GatherAllFilesToPublish is truly the last event you can do this yourself by enabling Diagnostic build output.

工具->选项->项目和解决方案->生成并运行-> MSBuild 项目构建输出的详细程度->诊断

Tools -> Options -> Projects and Solutions -> Build and Run -> MSBuild project build output verbosity -> Diagnostic

构建项目并搜索完成的构建目标"GatherAllFilesToPublish" ,对我来说,这是开始将文件复制到发布位置之前的最后一个触发器.

Build the project and search for Done building target "GatherAllFilesToPublish", for me this was the last trigger before it started copying the files to the publish location.

这篇关于pubxml Web发布工具事件生命周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆