I have been successfully using an exe (output of console app that i wrote) along with its application config file for a while. When i zipped them and sent it to my manager, he asked if i could get rid of the app.config file so the only thing that he copies in future is the exe.
Here is a gist of what my console app does. For example, my app.config has the following.
<userSettings>
<myapp.Properties.Settings>
<setting name="productline" serializeAs="String">
<value>Electronics</value>
</setting>
</userSettings>
When i run the app like
c:\>myapp.exe -productline Mechanical -save
it will update the productline settings to Mechanical. When i run my app again, the productline is retained as Mechanical until i change it again.
Back to the problem, I thought i will get rid of the app.config file and have a static variable 'productline' and update it. However, when i tested, the static variable is overridden only till i run the exe one time. Next time i run the exe, it goes back to default 'Electronics'. I assume the second time i run the exe is like running the web application with iisreset so the static variables are fresh again.
What is the best approach here? Can an app.config be embedded into the exe, so i can still use it but the output will be just one exe file? Or what is the alternate way to save and retain the variables in this scenario ?