使用webdeploy时如何用当前日期替换web.config设置? [英] How to replace a web.config setting with the current date while using webdeploy?

查看:76
本文介绍了使用webdeploy时如何用当前日期替换web.config设置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用web.config转换将设置替换为所选解决方案配置的设置.但是,我想添加一个设置来存储发布过程的日期时间.这样做的原因是能够为我的客户显示最新发布日期".

I'm using a web.config transform to replace settings with the settings of the selected solution configuration. However, I would like to add a setting that stores the datetime of the publish process. The reason for this is to be able to show a "Last published on" for my customers.

使用配置转换,是否可以用当前日期替换设置?

Using config transforms, is there a way to replace a setting with the current date?

推荐答案

我认为您将需要使用客户MSBuild任务来应用更改.

I think you're going to need to use a customer MSBuild task to apply the change.

我的妻子写了一篇关于在构建过程中添加自定义任务的博客(因为她比我更了解这些事情).

My wife blogged about adding custom tasks to the build process (as she understands these things better than I).

您可能会在

You might find some useful information on her blog (there are a few related posts).

或者,也许您可​​以从部署中的文件中获取上次修改日期",而不是将其保存在Web.config中?

Alternatively, maybe you could pick up the Last Modified date from a file in your deployment, rather than having it in Web.config?

这篇关于使用webdeploy时如何用当前日期替换web.config设置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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