0

How to update/replace the value from app.config for different environment using Teamcity? For Ex: Consider below URL is for one environment. add key="URL" value="https://www.google.co.uk"

Now I want to update this value through Teamcity for different environment as: add key="URL" value="https://www.google.co.in"

How can be done this using Teamcity? Can anyone please guide me on this?

Thanks,

Andreas Willich
  • 5,665
  • 3
  • 15
  • 22
kiranpk
  • 11
  • 5

2 Answers2

1

Usually this kind of changes are done with Add Config Transform in Visual Studio. Then you just build your project in different Configuration.

If you still want to do it in TeamCity, then you can use File Content Replacer in Build Features.

Peska
  • 3,980
  • 3
  • 23
  • 40
0

As the other answer mentioned you could do it with the File Content Replacer. However, this change is rolled back after the build is completed, so it will not appear in your artifacts.

Instead I would recommend adding a new build step with a Powershell runner type. You can replace the code in there eg: enter image description here

JumpingJezza
  • 5,498
  • 11
  • 67
  • 106