从MSBuild脚本发出HTTP请求 [英] Make an HTTP request from MSBuild script

查看:81
本文介绍了从MSBuild脚本发出HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种通过msbuild脚本访问Web应用程序/静态服务URL来触发远程过程的方法. 除了调用该外部应用程序,有什么方法可以做到这一点? 理想情况下,如果服务返回http 200以外的其他内容,我正在寻找一种打破构建顺序的方法

I'm looking for a way to hit a web app/restful service URL from msbuild script to trigger remote procedure. Is there any way how I can do that except calling that external app? Ideally I'm looking for a way to break a build sequence if service returned something else that http 200

推荐答案

我使用 MSBuild社区任务很多.他们为MSBuilds添加了额外的任务.在其中,有一个HttpRequest任务,从它的外观来看,它可以完成您想要的事情.

I use the MSBuild Community Tasks a lot. They add extra tasks for MSBuilds. In there is a HttpRequest task which, from the look of it, does what you want.

<HttpRequest Url="http://<mydomain.com>/index.php?checkdb=1" 
                EnsureResponseContains="Database upgrade check completed successfully." 
                FailOnNon2xxResponse="true" />

希望这会有所帮助

这篇关于从MSBuild脚本发出HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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