Configuration Transform

Free

Automatically transform app.config during build process. Once the transformation is set, it will run on other build machines without the extension.

(27) Review
Visual Studio
2013, 2012, 2010
Download (17,054)
9/29/2014
2.1
View
E-mail Twitter del.icio.us Digg Facebook
Add to favorites
Description
Reviews (27)
Q and A (25)
Sign in to write a review
Sort by:

by gord888 | September 15 2014

Works great - just needs a "preview transform" functionality that web.configs have.

Golan Avraham Sun 7:10 PM
| Edit |
Delete

version 2.0 released with preview support
thanks

by IanBusko | August 29 2014

This solution fills a huge hole in Visual Studio. It's easy to setup and (for me) has done its job perfectly so far. This makes setting up test stages much easier.

by darylnight | August 06 2014

perfetta

by xuzf | July 20 2014

It solved my headache, thanks very much!

by SteveKo | July 17 2014

Great plugin. Works like a charm. Just need to read instructions properly ! :)

by Real Daniel Byrne | June 29 2014

Doesn't work at all. Added a simple flag per the example on the download page.

Environment = ""
and Environment = "Debug" for Debug release. I then test for this flag in code.

if (ConfigurationManager.AppSettings["Environment"] == "Debug")

The debugger clearly shows that ConfigurationManager.AppSettings["Environment"] == "" and not "Debug".

Fail.

Golan Avraham July 17 2014
| Edit |
Delete

what about?

<?xml version="1.0"?>
<!-- For more information on using app.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="Environment" value="Debug" xdt:Transform="Replace" xdt:Locator="Match(key)"/>
</appSettings>
</configuration>

please follow instructions and see if it works

by Rodrigost | May 31 2014

Great job!
It helped a lot and let me give up wasting my time solving issues regard about config files in Windows Services projects.

by SegaWang | April 26 2014

Super nice tool. Thanks a lot

by Oleksiy Mishchenko | April 18 2014

Great little tool!
Easy to install and use.
Works well as expected.

Thanks!

by El Bruno | March 30 2014

Amazing app! I used it a lot!
Thanks

by _db | March 18 2014

Works like a charm!

by deadlyvices | February 17 2014

Fantastic little utility: one of those problems that seems to be blinding obvious to everyone once it's solved. It's robust and easy to use and saves huge amounts of time.

by BuzzoCraft | January 27 2014

by CrappyCode | January 23 2014

Works flawlessly.
Definitely should be integrated into VS.
Thanks for this, Golan!

by GregOsborne | December 05 2013

Great extension.

Would like to see it work with Silverlight on the ServiceReferences.ClientConfig file.

by Stinky Buffalo | October 30 2013

Top notch. This is the lightweight solution I was looking for, and has saved me lots of time. Thank you!

by IdleMonkeys | September 09 2013

by Sebastien Curutchet | August 14 2013

I've just played with appsettings and it is very useful.
Thank you for this addon

by gocoelho | June 24 2013

Adds the same behavior that emerged in Web.Config files. The feature should be included as native in Visual Studio.

1 - 20 of 27 Items   
Sign in to start a discussion


  • Error
    3 Posts | Last post Mon 12:13 PM
    • New version 2.0 causes error with vs 2012: Could not load file or assembly 'Microsoft.VisualStudio.Shell.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
      
      The error started showing after updating to 2.0
    • thanks for the update
      will fix it today
    • released a hot fix, please check 
  • any plan to add "preview" feature?
    8 Posts | Last post Sun 7:13 PM
    • is there a way we can preview web.cofig files?
    • Thought about this feature, I cannot commit but I'll try implement in next releases
    • tahks for this extension. And ability to preview App.config would be awesome :)
    • That would be a great feature to have. Really appreciate this extension! It's proving to be very useful.
    • Extension works great, adding the preview would sweeten the deal.
    • "Preview Transform" just like the Web.Config feature would be a killer!
    • +1 for App.config "Preview Transform"!
    • version 2.0 released with preview support
      thanks
  • Add Preview Transform
    2 Posts | Last post Sun 7:11 PM
    • Hi,
      
      in web.config transforms, we can select "Preview Transform" when right-clicking on any transform .config file.
      
      Would it be possible to add the same feature for App.config transforms. 
      
      Thanks,
      Stevo
    • version 2.0 released with preview support
      thanks
  • ClickOnce and Microsoft.Bcl.Build
    1 Posts | Last post September 02, 2014
    • Hi, I encountered a bug when using configuration transform in a WPF application and using ClickOnce for publish when Microsoft.Bcl.Build nuget package is installed.
      Steps to recreate:
      1. Create empty .NET 4.0 WPF application
      2. Create app.config or install some nuget package which creates it for you, e.g. Entity Framework
      2. Add configuration transforms
      3. Enable ClickOnce security and sign application with temporary certificate.
      4. Publish. So far it is working as intended.
      5. Install Microsoft.Bcl nuget package, which will install Microsoft.Bcl.Build
      6. Publish now generates error that there are more than one configuration files and build fails.
  • Settings files
    2 Posts | Last post July 11, 2014
    • I want to use this for a class library (DLL). If I manually change the connection strings in my app.config nothing actually changes until I update my settings file. Will Configuration transforms automatically update my settings file when I publish to test?
    • Hi There,
      Yeah, I'm struggling to get this working too. My connection strings are defined like this in app.config...
      
      <add name="FGD_TOM.My.MySettings.FGDTOMConnectionString" connectionString="Data Source=sql01;Initial Catalog=FGDTOM;Integrated Security=True" providerName="System.Data.SqlClient" />
      
      (And this 'Configuration Transform' extension doesn't seem to be able to perform a transformation on the XML) Anyway, that's also a connection string defined in the Settings.settings file.
      
      I just don't understand how it all hangs together. Any ideas?
  • Fix linked configs creation when source config is located in solution sub folder.
    8 Posts | Last post June 07, 2014
    • You indicated your last release included the following update, "Fix linked configs creation when source config is located in solution sub folder." Can you please describe the steps to utilize this update? 
      
      Ultimately what I'm trying to do is share the same App.Config and config transforms across multiple projects so they do not have to be duplicated. Is this supported?
    • I have found a way to do this, but it breaks the "Add Config Transforms" menu item (throws an exception). If I understand how you expect people to setup the folders related to your last fix in April I think I might be able to get this to work.
      
      Thanks in advance,
      Jennifer
      
    • Please send(sky drive) me application sample to test this issue.
      No setup is required to use this feature
    • Golan,
      
      Thanks for the response. How do I send you a sample application via Sky drive? I cannot send you my current sln because it is not something I can share publicly, but I can recreate a new sln demonstrating the problem. 
      
      Here is a more detailed description to the problem:
      
      I have a sln which includes many projects. The App.Config and transforms are located in the same directory as the sln file. The project I'm seeing the exception from when trying to utilize the "Add Config Transforms" menu has the following <ItemGroup> to include these app.config and transforms:
      <ItemGroup>
          <None Include="..\..\..\App.config">
            <SubType>Designer</SubType>
          </None>
          <None Include="..\..\..\App.PPE.config">
            <DependentUpon>App.config</DependentUpon>
            <SubType>Designer</SubType>
          </None>
          <None Include="..\..\..\App.Ship.config">
            <DependentUpon>App.config</DependentUpon>
            <SubType>Designer</SubType>
          </None>
        </ItemGroup>
      
      Just by adding the app.config's to the project in this way broke the transform completely, so I had to modify the path in the "AfterCompile" target so it was able to find the app.config and transform files:
      
      <Target Name="AfterCompile" Condition="Exists('..\..\..\App.$(Configuration).config')">
          <!--Generate transformed app config in the intermediate directory-->
          <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>
        </Target>
      
      After updating the path to the App.config, the transform started working again. Still errors when adding new linked con
    • I couldn't add anymore to the above reply. Given the above setup here is the repro to the error:
      
      1. Right click on App.Config and select "Add Config Transforms" menu.
      2. The dialog box opens asking, "Add as linked conifgs?" (includes typo in dialogue)
      2a. If I select "Yes" then I get the following error message, "Object reference not set to an instance of an object.".  
      2b. If I select "No", it raises the following error, "Cannot add the file 'App.Ship.config'. There is already a linked file in this folder with the same name." 
      
      Also at this point I went and looked in the csproj's folder and found an empty App.Ship.config file in that directory.  
      
      Then when repeating steps 1, 2, & 2b again then it raised the same error indicating App.PPE.config was already included in the project and again created the App.PPE.Config in the csproj file location. Repeat steps 1, 2 & 2b again then it will create the new App.x.config file (where x is the new build definition I've added) in the same location as the csproj. To be clear, this is reproducible for me in multiple projects I have in my sln.
      
      The feature worked originally for me when I had a new csproj that I added the app.config to that project as a new file and then added the linked config transforms. 
      
      Since I have many projects requiring the same config transforms I decided to try to move the files to the sln root and added them back to the original project. Then as described in my last post this broke the transformation of the config files until I modified the path in the "AfterCompile" target.  This is why I think I'm not doing this in the way you intended and if I understand how you expect people to setup the folders related to your last fix in April then I think I might be able to get this to work.
      
      Thanks in advance and I hope this helps outline the problem better for you!
      Jennifer
       
    • I think this error is raised because you are using source linked config not included in project, in my solutions the source linked configs are located in common project.
      Anyway I found a bug in relative path retrieval I'll fix it and add your use case(linked configs not included in project).
      thanks for the info
    • Jennifer please try version 1.5 it should solve your problem.
      
    • Thanks Golan this did stop the exceptions from being raised.  Can you describe or provide a sample of how you shared your configuration with the common project? Perhaps that is a better way of doing this.
      
      Thanks in advance,
      Jennifer
  • Latest Build Breaks Transforms
    2 Posts | Last post May 28, 2014
    • I had to update the project file to make the following changes...the path was incorrect - "\" means root, I had to change it to ".\" -->
      
      <Target Name="AfterCompile" Condition="Exists('.\app.$(Configuration).config')">    
          <TransformXml Source=".\app.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="app.$(Configuration).config" />
          <ItemGroup>
            <AppConfigWithTargetPath Remove="app.config" />
            <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
              <TargetPath>$(TargetFileName).config</TargetPath>
            </AppConfigWithTargetPath>
          </ItemGroup>
        </Target>
    • Thanks for the update SilverNinjas
      New version(1.6) released
  • Latest Build Breaks Transforms
    1 Posts | Last post May 28, 2014
    • I had to update the project file to make the following changes...the path was incorrect - "\" means root, I had to change it to ".\" -->
      
      <Target Name="AfterCompile" Condition="Exists('.\app.$(Configuration).config')">    
          <TransformXml Source=".\app.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="app.$(Configuration).config" />
          <ItemGroup>
            <AppConfigWithTargetPath Remove="app.config" />
            <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">
              <TargetPath>$(TargetFileName).config</TargetPath>
            </AppConfigWithTargetPath>
          </ItemGroup>
        </Target>
  • class library deployed to web.
    1 Posts | Last post May 27, 2014
    • Will this work with a class library? When I add the config transforms, the application continues to use the connection strings in the Settings.settings file.
  • ClickOnce deploy VSTO issue
    5 Posts | Last post May 14, 2014
    • Not sure if this issue is the extension, or the standard MSbuild targets. If I create a VSTO project (Word add-in), use your extension to transform app.config depending on configuration, then use publish to deploy, it appears the config file included with the deployment is the original un-transformed app.config, not the transformed one generated in the build process. This is a pain, because it means I have to have a script to copy the correct config after I publish.
      
      I'm tending to think it's an issue with the common msbuild targets, but I thought I'd ask here before I delve into that haystack.
    • Class library project(Word Add-In) is not is missing the AfterPublish target
      It can be supported very easily
      
      Try this:
      Unload Project-> edit wordaddin.csproj
      After <Target Name="AfterCompile"…> and before </Project>
      
      Add this:
        <Target Name="AfterPublish">
          <PropertyGroup>
            <DeployedConfig>$(_DeploymentApplicationDir)$(TargetName)$(TargetExt).config$(_DeploymentFileMappingExtension)</DeployedConfig>
          </PropertyGroup>
          <!--Publish copies the untransformed App.config to deployment directory so overwrite it-->
          <Copy Condition="Exists('$(DeployedConfig)')" SourceFiles="$(IntermediateOutputPath)$(TargetFileName).config" DestinationFiles="$(DeployedConfig)" />
        </Target>
      
      Save file->Reload Project
      
      Update me if it solved your issue I’ll include this change in my next release
      
    • Class library project(Word Add-In) is missing the AfterPublish target
      ...
    • You guys did very good job by providing this extension. I am using VS2010 but my deployment project always picks up the untransformed app.Config. Can you let me know what else I am missing?
      
      Thanks,
      Mohan
    • I have the same issue using VS2010.   The untransformed app.config file is published.  I have unloaded the project and had a look at the csproj file and the commands mentioned above are there.   Am I missing something?
      Thanks
      Ade
      
1 - 10 of 25 Items