Search code examples
c#.netvisual-studiomsbuildbuild-definition

C# - Class Library Project - Unable to update App.config file while building the project


I have a C# based Selenium project which has an app.config file. This app.config file has sensitive information which should NOT be made available in the code explicitly.

Is there a way to pass in the password to the app.config file before building the project.

The password can be supplied in the Build settings ( in variables section ) and can be made hidden.

Is there a way to read the values from the Process variables tab and update the values in the app.config file before building the project?

Or is there a way to send the password in an obfuscated/encrypted fashion using C#?

I cant user Replace tokens build step due to some constraints ( since it is a custom marketplace extension ) If there is a task by Microsoft which helps me in this scenario.

Thanks in advance for your help on this.


Solution

  • I did many things. Nothing worked. At last I just encrypted the password made it available as a REST service. Invoked the service while running my test and Decrypted and ran it. Thanks all for your work on this.