We have two code bases for testing and production. The only differences between the two code bases are in two files:
- Configuration file
- Build File (.csproj)
Maintaining two branches is a significant effort that can be eliminated by combining the codebases into one and using continuous integration (for example, Hudson, for example) to change the files according to the target environment.
VS2010 has a very smart configuration file solution that allows us to define various configuration file conversions for the two release configurations of the Release-Test and Release-Prod assemblies.
However, we have some differences that are reflected in the project file (.csproj), for example:
- Result assembly name: Foo.exe vs. Foo-Test.exe.
- Build version
- ClickOnce Deployment Settings.
Is there any smart way to convert the csproj file based on the assembly configuration, or how can these parameters be extracted into a configuration file or C # code?
Update:
I tried with the conditional properties of MSBuild in the csproj file, as suggested by @JaredPar, but it has a few caveats (see my comments for details). Are there other ways to achieve this?
source share