问题
Upon editing a build, I can set some 'variables'. Is it possible to have these variables be used to transform web.config?
回答1:
Usually, web.config is transformed base on the build configuration and the value is stored in their transformation files. So if you create a variable for configuration such as $(BuildConfiguration), you can set the build configuration to this variable and set the value of this variable to control the build configuration and the web.config will be transformed base on the configuration.
If you want to transfer the value of a variable into web.config file. You can use Tokenization task. This task could read the variable value and write it to web.config.
来源:https://stackoverflow.com/questions/35701401/populate-web-config-with-build-variables