Okay I’ve got my app.config file that is containing my database settings.
All works well on my development machine. But when I install it on a test machine I’m getting a null reference on the following line:
ConnectionString = ConfigurationManager.ConnectionStrings[“MyDBConn”].ToString();
Why is this happening? I guess that the app.config file isn’t found. But isn’t this included when you build the setup?
I’m using a very simple setup project in VS2008.
The file
app.Configis your source, don’t distribute it. When Visual Studio builds your project it copies the file to{AppName}.exe.config(in the same folder as{AppName}.exe) and that is the file you need to include in your setup.