NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

Install-Package : An error occurred while applying transformation to 'Web.config' in project 'x' No attribute 'key' exists for the Match Locator #5481

Open ja0b opened 7 years ago

ja0b commented 7 years ago

Details about Problem

Using web.config.install.xdt I'm trying to add a new appSetting to the web.config.

What I'm using is this:

  <appSettings xdt:Transform="InsertIfMissing" />
  <appSettings>
    <add key="test1" value="false" xdt:Locator="Match(key)" xdt:Transform="InsertIfMissing" />
    <add key="test2" xdt:Locator="Match(key)" value="~/test,~/test1/,~/.test2/" xdt:Transform="SetAttributes" />
  </appSettings>

I'm hosting this package on myget and the weird this is that if I download the nupkg and install it using

Install-Package C:\………\package.nupkg

It works! and applies all the desired transforms. No errors, all good.

But if I do

Install-Package package

The error gets thrown, I decided to remove these transforms just to get the package working and still is complaining about not finding the attribute key, then I unzipped the nupkg to check the xdt files and the transforms were not there.

Have you seen this behavior before? Ideas ?

NuGet product used: NuGet.exe NuGet version: 4.1.0

mishra14 commented 6 years ago

@ja0b Can you please check if the web.config file has the keys test1 and test2?