Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7708433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:36:39+00:00 2026-06-01T00:36:39+00:00

We have two code bases for testing and production. The only differences between these

  • 0

We have two code bases for testing and production. The only differences between these two code bases are in two files:

  • The config file
  • The build file (.csproj)

Maintaining two branches is a considerable effort which could be eliminated by merging the code bases into one and using a Continuous Integration (such as Hudson, e.g.) to modify the files according to the target environment.

As of VS2010, there is a very smart solution for the config files that allows us to define different config file transformations for two build configurations “Release-Test” and “Release-Prod”.

However, we have some differences that are reflected in the project file (.csproj) such as:

  • The name of the resulting assembly: Foo.exe vs. Foo-Test.exe.
  • The assembly version.
  • The ClickOnce deployment settings.

Is there any smart way how the csproj file can be transformed based on the build configuration, or how these settings can be extracted into a config file or C# code?

Update:

I tried with conditional MSBuild properties in the csproj file as suggested by @JaredPar, but it has a couple of caveats (see my comments for details). Are there any other ways to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:36:41+00:00Added an answer on June 1, 2026 at 12:36 am

    It sounds like you want to use a single csproj and control elements like the assembly name based on a specific build configuration. If so then you’re looking for the Conditional element on MSBuild properties

    <AssemblyName Condition="'$(Configuration)' == 'Release-Prod'">Foo</AssemblyName>
    <AssemblyName Condition="'$(Configuration)' == 'Release-Test'">Foo-Test</AssemblyName>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two code bases of an application. I need to copy all the
I have a code base, in which for Matrix class, these two definitions are
I have these two pieces of code, wich one is more readable? foreach decimal
I have two string variables which are both file paths. The code that worked
In my code base I find that two modules have structures with the same
I have the following two code blocks. Code block 1 var checkboxes = $(div.c1
I have two pieces of C++ code running on 2 different cores. Both of
I have two controllers which share most of their code (but must be, nonetheless,
I have two identical byte arrays in the following segment of code: /// <summary>
Hi guys I wrote this code and i have two errors. Invalid rank specifier:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.