I am trying to match element by element name, I have to change sessionState element timeout in release, but I cannot match it by any attribute value.
<sessionState timeout="5000"/>
How can I match this element in Web.Release.config?
A transform file is an XML file that specifies how the Web. config file should be changed when it is deployed. Transformation actions are specified by using XML attributes that are defined in the XML-Document-Transform namespace, which is mapped to the xdt prefix.
If you are using the extension Configuration Transform go to Build > Configuration Manager and find the Configuration dropdown for the project of which you want to change the app config. You can then select the edit and rename the build configurations for that project.
A Web. config transformation file contains XML markup that specifies how to change the Web. config file when it is deployed. You can specify different changes for specific build configurations and for specific publish profiles.
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).
this should work:
<sessionState timeout="2000"
xdt:Transform="SetAttributes(timeout)">
</sessionState>
In case there are those that would like to change all attributes here it is
<sessionState xdt:Transform="SetAttributes" xdt:Locator="XPath(/configuration/system.web/sessionState)"
mode="SQLServer"
stateConnectionString="tcpip=1234.00"
sqlConnectionString="myConnection"
cookieless="false"
timeout="2000" />
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