Where does the config file go?

  • Thread starter Thread starter Jerry Spence1
  • Start date Start date
J

Jerry Spence1

I am getting a protocol violation error from an IP product and after some
searching I found the following fix:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<!-- User application and configured property settings go here.-->
<!-- Example: <add key="settingName" value="settingValue"/> -->
<add key="Button1.Enabled" value="True" />
</appSettings>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true"/>
</settings>
</system.net>
</configuration>

However, I can't find what you do with this file and what to call it. Google
searches seem to offer some alternatives - none of which work. So far, I
have called it app.config and placed it in the project root directory. Some
help would be appreciated.

-Jerry
 
Is this a windows or web app?

For web, you need a web.config.

For a windows app, if your application name is myApp.exe, the configuration
file name should be myApp.exe.config. app.config is the name of the file in
visual studio, and on build it copies the file out to the output directory
with the naming convention as I described.
 
Thanks for that. It is a windows app. And in what folder should it go? My
confusion is that I have an application with app.config in the project
folder, and this contains the correct text (as below) and it works OK. In
both my bin\debug and bin\release folders, there is MyApp.exe.config. Also a
MyApp.vshost.exe.config. I haven't put any of those there and I wondered if
they had been produced from the base app.config which I edited.

-Jerry
 
Back
Top