Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can partial config files linked to a web.config via configSource be transformed in a web project?

Looking for some help from anyone that's worked with SlowCheetah to transform config files under a web project. We're finding that partial config files referenced from the web.config are not being transformed.

For example, we've included references to partial configs AppSettings.config and ConnectionsString.config in the web.config like so:

  </system.web>
  <connectionStrings configSource ="ConnectionsString.config"></connectionStrings>
  <appSettings configSource ="AppSettings.config"></appSettings>
</configuration>

and then in the AppSettings.config we have just the AppSettings section like so:

<appSettings>
  <add key="LostPasswordBCC" value="[email protected]" />
</appSettings>

and finally in the transform file AppSettings.Debug.config we have some additions:

<?xml version="1.0" encoding="utf-8" ?>
<!-- For more information on using transformations 
     see the web.config examples at http://go.microsoft.com/fwlink/?LinkId=214134. -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <appSettings >
    <add key="Release" value="Something" xdt:Transform="Insert" />
  </appSettings>
</configuration>

Obviously the above is just a test to see the transform occur, but what we're finding is that on attempting to preview the transform all we get back is an error "There was an error processing the transformation." The publish attempt also fails.

If we make the config files fully formed xml and not referenced from web.config, the transformation seems to work fine - but were looking to share these files across multiple projects.

Does anyone know if there's a workaround where we can both reference partial configs from the web.config and also have transforms off those partial files? We're dealing with legacy code with a large number of config files across multiple web projects that were attempting to consolidate, thus the need to link from web config to separate shared files.

like image 772
Richard Paluzzi Avatar asked Oct 23 '12 19:10

Richard Paluzzi


1 Answers

Problem has been resolved, turns out after help from Sayed, we determined that in our efforts to understand the config transformation process with a web project we had corrupted the transform config file's format. With freshly created config files we were able to get transforms to work using SlowCheetah.

This allowed us to move on the real problem we needed to address which was wanting to transform project configs other than the web.config using Visual Studio 2012's publish profiles. This did not work originally, but again Sayed helped us out and provided a new copy of SlowCheetah that allowed this to work.

Below is a link to the new version of SlowCheetah with the fix: https://github.com/sayedihashimi/slow-cheetah/issues/46

Much thanks for all your time and patience Sayed.

like image 114
Richard Paluzzi Avatar answered Oct 14 '22 01:10

Richard Paluzzi