ConectionString in app.config ignored

9 views
Skip to first unread message

cppquester

unread,
May 13, 2008, 11:07:28 AM5/13/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
If I change my app.config file, nothing happens: The DB is accessed
like before.
No error, everything seems to work normal.
I rebuild my solution, even after restarting VS2005.

My questions:
1. When is the input of app.config taken? Why am I not seeing any
effect?

2. app.config appears in one project of my solution, I cannot se it
in the release version.
The data isn't in MyMain.exe.config
Where is the data stored?

Thanks,
regards,
Marc

Cerebrus

unread,
May 13, 2008, 1:10:57 PM5/13/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Your config will be built into the the Bin directory of the current
project only. I'm currently dealing with the same problem and am
having to manually copy the "MyProject.dll.config" file to the Startup
project's Bin directory.

I wonder if someone else can shed light on a way to automatically
build the config file to the main project build directory.

Andrew Badera

unread,
May 13, 2008, 1:16:23 PM5/13/08
to DotNetDe...@googlegroups.com
I'm having a hard time understanding the issue ... why do you have to fuddle around with the .config C? Educate me please!


OP:
.config files are read on startup/application pool recycle (I think)/web app recompile

.config file sections can be manually refreshed using .RefreshSection()
--
--
--Andy Badera
http://higherefficiency.net
http://flipbitsnotburgers.blogspot.com/
http://andrew.badera.us/
http://changeroundup.com/
and...@badera.us
(518) 641-1280
Google me: http://www.google.com/search?q=andrew+badera

Crisatunity (blog.crisatunity.com)

unread,
May 13, 2008, 2:52:41 PM5/13/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
> I wonder if someone else can shed light on a way to automatically
> build the config file to the main project build directory.

Cerebrus - get away from your libraries having an "application" config
file. They are for, you guessed it, applications. If your library is
utterly dependent upon config information and you don't even have an
application then you've got to get into some fancy deployment
operations - like getting your config information into the host's
framework config.

cppquester

unread,
May 14, 2008, 3:32:17 AM5/14/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
On May 13, 7:16 pm, "Andrew Badera" <and...@badera.us> wrote:
> I'm having a hard time understanding the issue ... why do you have to fuddle
> around with the .config C? Educate me please!
>
> OP:
> .config files are read on startup/application pool recycle (I think)/web app
> recompile

I want to be able to change the DB connect string (DSN, name,
password). I think this information is in the
config file (of one project of my solution, actually I don't see the
information in the exe.config file of the program)
But there isn't any effect when I change it in the config file and
rebuild afterwards.
The program still uses the same DB.

Regards,
Marc
> --Andy Baderahttp://higherefficiency.nethttp://flipbitsnotburgers.blogspot.com/http://andrew.badera.us/http://changeroundup.com/

Andrew Badera

unread,
May 14, 2008, 2:33:41 PM5/14/08
to DotNetDe...@googlegroups.com
You realize that only a single config file is deployed for an entire application or website, right? And that's the app.config of your target project, or web.config of the website you're building. Are you trying to use multiple .config files for a single solution?
Reply all
Reply to author
Forward
0 new messages