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?
the answer i found :- ASP.NET invalidates the existing cache and assembles a new cache. Then ASP.NET automatically restarts the application to apply the changes.
If you have a web application project, Right-click on web. config and choose Add Config Transform. This will add any config transforms that are missing from your project based on build configurations (i.e. if you have Production and Staging build configs, both will get a transform added).
A web. config file is a Windows file that lets you customize the way your site or a specific directory on your site behaves. For example, if you place a web. config file in your root directory, it will affect your entire site (www.coolexample.com).
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).
Alternatively, maybe you could pick up the Last Modified date from a file in your deployment, rather than having it in Web.config?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With