Automatically encrypt database connection strings in Visual Studio

Automatically encrypt database connection strings in Visual Studio
This article shows you how to automatically preserve your database connection string in app.config whilst also deploying an encrypted version in your production app….

In my example, I am connecting to a remote MySQL database from a winforms app.

Add your data source via the usual means, choosing to save your password and store in app.config:

The open ProjectSettings > Compile > BuildEvents > Edit Post-build

and post the following code:

Replacing “YourAppWithoutExtention” with your app name.

Then every time it builds, it will automatically encrypt your app.config.

Share this:
0 votes

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">