Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 23rd, 2007, 04:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default Build Specific Settings?

Hi everybody!

can someone please tell me how I can set different connection strings for different build stages using VS2005?

I want to connect to our 'Dev' database while I'm running in debug, but use our production database when I compile the release version.

Cheers,

Chris

There are two secrets to success in this world:
1. Never tell everything you know
__________________
There are two secrets to success in this world:
1. Never tell everything you know
 
Old August 23rd, 2007, 09:36 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

The debug build configuration is preconfigured to include the "DEBUG" preprocessor symbol in the compile. Therefore you can do this:

#if DEBUG
    strConnectionString = <get dev conn string>;
#else
    strConnectionString = <get production conn string>;
#endif

You can also define your own symbols if you wanted to use other configurations.

-Peter
 
Old August 24th, 2007, 06:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Peter.

There are two secrets to success in this world:
1. Never tell everything you know





Similar Threads
Thread Thread Starter Forum Replies Last Post
Search specific data from specific columns yogeshyl SQL Language 1 January 16th, 2008 11:12 AM
Changing Settings.settings when assembly is in GAC evandro.paula .NET Framework 2.0 0 September 25th, 2007 09:54 AM
Copy specific data in specific cells of sheet2 yogeshyl Excel VBA 1 May 14th, 2007 07:40 AM
Copied Configuration Settings but Doesn't build oolatin79 Visual C++ 1 July 17th, 2006 07:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.