Results 1 to 3 of 3

Thread: VS2010. Conditional Build. Two versions of same program in one solution ?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    VS2010. Conditional Build. Two versions of same program in one solution ?

    I didn't see a forum area specifically about configuring visual studio. So here goes.

    I've got a program but now I want to make two versions of it. Lets call them 'Home' and 'Pro' where the Home simply has some features disabled based on the value of a boolean const or variable.

    To do it manually I'd change the value of the boolean. Change the output exe name and build. Then change the bool again, change the output name and build. I've now got two different programs.

    But is there some way to automate that so I just hit the button to build and VS does that for me ?

    Sorry if this is the wrong area (I'm sure the mods will move it) and I'm also sorry if I didn't explain very well - I'm sure you know what I mean though.

    Thanks
    Ax

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: VS2010. Conditional Build. Two versions of same program in one solution ?

    You know how you can select Debug or Release for the build? Those are two different configurations and the output for each one goes into a different folder. You can open the Configuration Manager and create additional configurations if you so desire. From the Compile page of the project properties, you can add custom compilation constants for certain configurations and then use those constants in your code to include and exclude certain code based on the current configuration. When it's time to build, you select one configuration and build, then select another configuration and build again. Go to the bin folder and get the two separate outputs from the two separate subfolders.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2004
    Posts
    141

    Re: VS2010. Conditional Build. Two versions of same program in one solution ?

    Quote Originally Posted by jmcilhinney View Post
    You know how you can select Debug or Release for the build? Those are two different configurations and the output for each one goes into a different folder. You can open the Configuration Manager and create additional configurations if you so desire. From the Compile page of the project properties, you can add custom compilation constants for certain configurations and then use those constants in your code to include and exclude certain code based on the current configuration. When it's time to build, you select one configuration and build, then select another configuration and build again. Go to the bin folder and get the two separate outputs from the two separate subfolders.
    Wow, it's that simple ? I feel silly for asking the question.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width