Updating “Web References” as part of TFS Builds

2019-06-03 22:18发布

问题:

Is there an easy way to update Project "Web References" as part of a TFS build?

For some background... I have a couple Web References pointing at public services. The service providers change their contracts periodically and I'd like to discover this in a nightly build.

I know I could build an MSBuild task that downloads the WSDL and build reference assemblies using svcutil but that would mean changing a lot more about the projects structure. Is there something built-in to the .NET stack, TFS, or MSBuild that could do what I need?

回答1:

I would avoid having this update done by automatic tools. There is a strong possibility that the code would not compile after such a service contract change. And even if the code does compile, someone should still inspect whether the WSDL change requires some other actions to be taken in your project, other than just updating the service client (perhaps even changes in business rules).

What I would do is write a simple tool that regularly downloads the WSDLs and sends notifications if anything changed - so the appropriate people can take action in such cases.

The tool could be run as a custom tool in MSBuild or simply using the Windows Task Scheduler.