How to develop and deploy the test and production version of the application at the same time


I would need some advice how to set up my development process so that I can easily develop and deploy both the test and the production version of my application.

Current state of my project:

  • Visual Studio 2010, C#, .NET 4.0, WinForms application, SQL Server 2008
  • Mercurial source control
  • Click-Once deployment to a shared folder in our company's intracet
  • Only one solution in Visual Studio (typical workprocess: make some changes -> publish, repeat)

What I would like to have:

  • Two separate environments - one for production application and one for a test application, which is the same a production application but with added features, which may or may not be added to the main application.
  • I would like to publish both applications with Click-Once (for example App and AppTest)
  • I would like to have an option to simply 'move' changes from Test application to Main application, or simply discard them.

My plan is to clone my existing repository into a new one (from App to App-Test for example) so I will end up with two seperate codebases. Then the new features would be implemented and published in the App-Test application. When the users are happy with the testing version, I would somehow move changes from App-Test repository to App repository (probably with the Mercurial's merge command) and then publish production application...

Is this a the right way to achive this? Any other suggestions or links to some resources? Could this be done within the same repository somehow?

This may be one repository, but with 2 (or more) brunches. For example, we use git for source control and 3 brunches - develope, test, release. Features (or tasks) started their life in develope brunch. Then they moved (merge) in test, and after testing moved in release.

But you may get problem with database changes (are you use some ORM?), because you'll need to have 2 different database. If you don't use some ORM, merge database may be difficult. But I think that, for example, entity framework (code first) saved your time.

Good luck!