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

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.  
LVL 1
thefumblerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ptakjaCommented:
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:

CUSTOM_CLIENT=True

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

#if CUSTOM_CLIENT Then
    Code for custom client stuff goes here

#else
   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.

Jeff
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thefumblerAuthor Commented:
ptakja,

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.
0
ptakjaCommented:
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.
0
thefumblerAuthor Commented:
I haven't been able to find any better way, so ptakja's method is probably the best.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.