37

Closed

Transformations on web.config when it has DependentUpon reference

description

Related Thread: http://nuget.codeplex.com/discussions/261605

For my application web.config file is generated by t4 template. And as a result my web.config file is nested from web.tt file.
Now when I install elmah, for example, I get following output:

PM> Install-Package elmah
Successfully installed 'elmah 1.2.0.1'.
'web.config' already exists. Skipping...
'web.config' already exists. Skipping...
Successfully added 'elmah 1.2.0.1' to ProjectNameToken.Web.

And no configuration of elmah added to web.config file. I verified that elmah section is not present in solution:

Find all "elmah", Subfolders, Find Results 1, "Entire Solution", ""
Matching lines: 0 Matching files: 0 Total files searched: 101

This happens because web.config file has attribute DependentUpon:
<Content Include="Web.config">
  <AutoGen>True</AutoGen>
  <DesignTime>True</DesignTime>
  <DependentUpon>Web.tt</DependentUpon>
</Content>
If remove it then nuget performs required transforms. I'm using NuGet 1.3.20419.9007 version.

file attachments

Closed Jul 27, 2012 at 12:26 AM by aldion
Verified
  • transformations applied to web.config generated by web.tt
  • works when web.config has files that are dependentUpon

comments

dfowler wrote Jun 17, 2011 at 7:13 AM

Can you provide the t4 template?

SlyFox wrote Jun 17, 2011 at 7:36 AM

Here is web.tt file

drusha wrote Jun 17, 2011 at 7:38 AM

We desperately need T4 support as well, cause we extensively use transformations in our projects and this is the only reason why we can't start using NuGet in every project.

frederikvig wrote Aug 24, 2011 at 10:26 AM

I can confirm this behavior. We have projects that have multiple configuration files that are nested (uses <DependentUpon>Web.config</DependentUpon> element) under web.config that we can't modify with NuGet XML Transforms.

dotnetjunky wrote Dec 14, 2011 at 1:36 PM

Consider doing this for 1.7

dotnetchris wrote Dec 28, 2011 at 3:45 PM

I added comments to the discussions thread. This also seems to impact usage of web.staging.config transforms that get ignored.

stimpy77 wrote Feb 23, 2012 at 4:21 PM

ditto on dotnetchris, this is a bigger problem than *.tt files, this is an issue for any custom web.{buildmode}.config as well. Please prioritize as we cannot find a reasonable workaround without hacking at the config file directly within powershell.

dotnetjunky wrote Jul 10, 2012 at 7:24 PM

bring back from backlog

dotnetjunky wrote Jul 26, 2012 at 11:05 PM

Fixed in changeset fdefd19dc13b8e5e46d7d0065876bcc

aldion wrote Jul 26, 2012 at 11:10 PM

note fixed in commit changeset fdefd19dc13b