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 6820463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:25:40+00:00 2026-05-26T21:25:40+00:00

I have a dll-type project that contains MSTest integration tests. On my machine the

  • 0

I have a dll-type project that contains MSTest integration tests. On my machine the tests pass, and I want the same to happen on a CI server (I use TeamCity). But the tests fail, because I need to tweak some settings in app.config. This is why I was thinking to have a separate second app.config file that will hold the settings for CI server.

So I would like to have

/Sln
 /Proj
  app.config (I think this is required by VS)
  app.Release.config (This is a standalone independent config file)

Thus if I select Release configuration in build config on CI, I would like to use app.Release.config file instead of app.config

Problem
This doesn’t seem to be straightforward for simple .dll type projects. For web projects, I can do web config transformations. I found a hack how to do these transformations for a dll type project, but I am not a big fan of hacks.

Question
What is a standard approach to tweak app.config files depending on build config for .NET projects (such as Debug, Release, …)?

  • 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-05-26T21:25:40+00:00Added an answer on May 26, 2026 at 9:25 pm

    Use SlowCheetah plugin. For more options and details of how to use SlowCheetah keep reading.

    As you have already noticed, there is no default and easy way to use different config files for a Library type (.dll) project. The reason is that the current thinking is: “You don’t need to”! Framework developers reckon you need configuration for the executable file: be it a console, desktop, web, mobile app or something else. If you start providing configuration for a dll, you may end up with something I can call a config hell. You may no longer understand (easily) why this and that variables have such weird values coming seemingly from nowhere.

    “Hold on”, – you may say, “but I need this for my integration/unit testing, and it is a library!”. And that is true and this is what you can do (pick only one, don’t mix):

    1. SlowCheetah – transforms current config file

    You can install SlowCheetah – a Visual Studio plug-in that does all low level XML poking (or transformation) for you. The way it works, briefly:

    • Install SlowCheetah and restart Visual Studio (Visual Studio > Tools > Extensions and Updates … > Online > Visual Studio Gallery > search for “Slow Cheetah” )
    • Define your solution configurations (Debug and Release are there by default), you can add more (right click on the solution in Solution Explorer > Configuration Manager… > Active Solution Configuration > New…
    • Add a config file if needed
    • Right click on config file > Add Transform
      • This will create Transformation files – one per your configuration
      • Transform files work as injectors/mutators, they find needed XML code in the original config file and inject new lines or mutate needed value, whatever you tell it to do

    2. Fiddle with .proj file – copy-renames a whole new config file

    Originally taken from here. It’s a custom MSBuild task that you can embed into Visual Studio .proj file. Copy and paste the following code into the project file

    <Target Name="AfterBuild">
        <Delete Files="$(TargetDir)$(TargetFileName).config" />
        <Copy SourceFiles="$(ProjectDir)\Config\App.$(Configuration).config"
              DestinationFiles="$(TargetDir)$(TargetFileName).config" />
    </Target>
    

    Now create a folder in the project called Config and add new files there: App.Debug.config, App.Release.config and so on. Now, depending on your configuration, Visual Studio will pick the config file from a Config folder, and copy-rename it into the output directory. So if you had PatternPA.Test.Integration project and a Debug config selected, in the output folder after the build you will find a PatternPA.Test.Integration.dll.config file which was copied from Config\App.Debug.config and renamed afterwards.

    These are some notes you can leave in the config files

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    
        <!-- This file is copied and renamed by the 'AfterBuild' MSBuild task -->
    
        <!-- Depending on the configuration the content of projectName.dll.config 
            is fully substituted by the correspondent to build configuration file 
            from the 'Config' directory. -->
    
    </configuration>
    

    In Visual Studio you can have something like this

    Project structure

    3. Use scripting files outside Visual Studio

    Each build tool (like NAnt, MSBuild) will provide capabilities to transform config file depending on the configuration. This is useful if you build your solution on a build machine, where you need to have more control on what and how you prepare the product for release.

    For example you can use web publishing dll’s task to transform any config file

    <UsingTask AssemblyFile="..\tools\build\Microsoft.Web.Publishing.Tasks.dll"
        TaskName="TransformXml"/>
    
    <PropertyGroup>
        <!-- Path to input config file -->  
        <TransformInputFile>path to app.config</TransformInputFile>
        <!-- Path to the transformation file -->    
        <TransformFile>path to app.$(Configuration).config</TransformFile>
        <!-- Path to outptu web config file --> 
        <TransformOutputFile>path to output project.dll.config</TransformOutputFile>
    </PropertyGroup>
    
    <Target Name="transform">
        <TransformXml Source="$(TransformInputFile)"
                      Transform="$(TransformFile)"
                      Destination="$(TransformOutputFile)" />
    </Target>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dll. That dll is uploaded on a server. I want that
I want to have a single Visual Studio project that builds a DLL file
I have a dll that contains a dot net assembly - common intermediate language.
I have a dll that contains a templated class. Is there a way to
I have a DLL that I want to profile.. I tried to use Very
I have a VB6.0 project that contains the line Implements IObjectSafety I tried reopening
I have a project that uses System.Runtime.Serialization assembly. I am using the type DataContractSerializer
We have a VB project that loads a reference to a .Net dll (which
Say I have the following interface that I want to share between my server
I have a WinForm project that I want to be usable as a console

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.