Improve company productivity with a Business Account.Sign Up


How do I use Configuration Manager to produce 2 slightly different versions of same program?

Posted on 2004-10-23
Medium Priority
Last Modified: 2013-12-03
I am pretty sure the configuration manager in visual studio is the place to figure this out, but don't know how.  I need to create 2 projects that have most of the same forms and code, but where the entry form on one deployment will be tailored for a specific client login procedure and another deployment that has a more generic login procedure.  
Question by:thefumbler
  • 2
  • 2
LVL 14

Accepted Solution

ptakja earned 2000 total points
ID: 12391001
You could use conditional compilation arguments to do this.  Open your project. Next select Project --> Properties.

In the BUILD section under Configuration, you can add your own constants as:


Next in your code you can include or leave out sections of code using the conditional compilation statements as:

    Code for custom client stuff goes here

   Code for everyone else goes here

#End If

You can set up your own build configurations to include this symbol or not...

Note that if the symbol is not defined, it will evaluate as false.


Author Comment

ID: 12402760

I expected a simpler way to do this without code - is this really the only way?   It just seems like this would be a very common issue for many developers and that there should be a option to select which files are included in which build.  I would prefer not to change the code in the generic version for everyone because I would have to deploy a new version for no benefit to those users.  This type of option would also be helpful in developing and testing so I can have very client specific files in a build for release and files related to my test development system in another build.  

I am still getting feet wet in .net so I may be out to lunch, feel free to say so.
LVL 14

Expert Comment

ID: 12402932
The project structure in Visual Studio .Net is file-based. That is, when you create a new project, files are created under the folder hierarchy for the project.  This even happens when you add an "existing" item to a project. In this case, Visual Studio doesn't point to existing file location, it goes over there and COPIES it to your local project folder. This makes it impossible to share source code between projects.

It sounds like you want to exclude/include various files for a project build. Since the build system in VS is _Project_ based and not file based I think you are out of luck.

An alternative to the conditional compilation idea I posted above would be to maintain 2 separate projects. But that is more headache than it's worth, in my opinion.

I may be out to lunch on this one as well, but as far as I know, the solutions I presented are the only ways to deal with this.

Author Comment

ID: 12549922
I haven't been able to find any better way, so ptakja's method is probably the best.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Article by: Jorge
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String ( Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

601 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