Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No element in the source document matches..." (NuGet Install Error)

I'm trying to install a package via the package manager console for PowerBI, and I keep getting this error:

    Install-Package : An error occurred while applying transformation to 'Views\web.config' in project 'Application': No element in the source document matches 
'/configuration/system.web/compilation/assemblies'
At line:1 char:1
+ Install-Package Microsoft.PowerBi.AspNet.Mvc
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidDataException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

The command I'm trying to run is:

Install-Package Microsoft.PowerBi.AspNet.Mvc

I've tried installing different versions, that hasn't worked either.

Not really sure why this is failing, I've never had issues with the package manager console before.

like image 866
Probably Avatar asked Jul 22 '16 14:07

Probably


1 Answers

Okay so not five minutes after I posted this, I figured out the issue. In my web.config, this block of code was not present

<compilation>
      <assemblies>
      </assemblies>
      <buildProviders>
      </buildProviders>
  </compilation>

Simply adding that between the <system.web> </system.web> headers allowed the install to work, and now my web.config has the following code:

<compilation>
      <assemblies>
          <add assembly="Microsoft.PowerBI.AspNet.Mvc, Version=1.1.1.16190, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
      </assemblies>
      <buildProviders>
      </buildProviders>
  </compilation>

Not really sure why the package manager can't create its own elements.. but all is well now. I'll leave this up just in case someone else has the same issue.

like image 88
Probably Avatar answered Nov 15 '22 13:11

Probably