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

  • Home
  • SEARCH
  • 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 6747523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:27:15+00:00 2026-05-26T12:27:15+00:00

I created an app.config transform for my WinForms project using Dan Abramov’s solution here

  • 0

I created an app.config transform for my WinForms project using Dan Abramov’s solution here. Works great and the config file is transformed and present in the correct obj folder.

When I look at the outputs for the Primary Output of my application, it gets the app.config from the project directory instead of the corresponding obj folder like everything else…a big oversight, in my opinion, by MSFT. Obviously, they didn’t have transforms in mind for all config file types.

So now, how do I get the Primary Output of my main project to output the config file from the obj folder based on the build configuration?

  • 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-26T12:27:16+00:00Added an answer on May 26, 2026 at 12:27 pm

    I found the work around I was looking for here. Scroll to the bottom and see kakoskin’s answer. In conjunction with Dan Abramov’s solution, I was able to get the results I was looking for. Here’s the MSBuild code I used:

      <Target Name="AfterBuild" Condition="exists('app.$(Configuration).config')">
    <TransformXml Source="app.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="app.$(Configuration).config" />
    <!-- Force build process to use the transformed configuration file from now on. -->
    <ItemGroup>
      <AppConfigWithTargetPath Remove="app.config" />
      <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
        <TargetPath>$(TargetFileName).config</TargetPath>
      </AppConfigWithTargetPath>
    </ItemGroup>
    <TransformXml Source="App.config" Transform="app.$(Configuration).config" Destination="App.Transformed.config" />
    

    The <ItemGroup> section will remove the app.config file from the corresponding obj\ folder and replace it with the transformed config file, which is not needed but I left it in there anyways.

    Hope this helps others out as well!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created an App.config file in my WPF application: <?xml version="1.0" encoding="utf-8" ?> <configuration>
I have created a library which reads the app.config file and gets the type
I have an app.Config that was created on the dev machine running Windows 7.
Is it possible to create a custom configuration file (other than app.config) that can
I've created an app that interacts with a SOAP service using java WS. I
I have successfully created an app that reads from a bundled .plist file and
Where does the App.config go when I publish a website using Visual Studio. I
I have an app.config file that I need to distribute with my application. It
My VB.NET 2008, .NET 3.5 application is using an app.config with settings defined as
Previously, the following was my .gitignore file: ... config/database.yml .DS_Store Later I created an

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.