Solved

net windows app.config change setting for sqlconnection in build

Posted on 2009-07-06
4
522 Views
Last Modified: 2013-12-17
Hi

Have windows application in c# (.net) and using sql express - when developing have sqlconnection string in settings to local but when create exe for user/distribution I want to change the connection string in the app.config file

I thought it would fit in build events (pre or post) but cannot find code snippet to change values to user setting and after buil;d bakcto development

any ideas on code syntax or is there a better way to do it

Rgds
stephen
0
Comment
Question by:stephenwilde
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 250 total points
ID: 24783991
0
 
LVL 13

Assisted Solution

by:Philip Pinnell
Philip Pinnell earned 250 total points
ID: 24783995
0
 

Author Comment

by:stephenwilde
ID: 24784077
Thanks

But in app config file using an application variable not full connection string for which is no option in my visual studio winddows application to do - and the syntax in pre/post build seems dos like dont wont 2 app config files to maintain as lots of other items/settings in them so would need syntax to change only a value

Rgds
stephen
0
 

Author Closing Comment

by:stephenwilde
ID: 31600100
Thanks
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now