简体   繁体   English

“源文档中没有元素匹配......”(NuGet安装错误)

[英]“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: 我正在尝试通过软件包管理器控制台为PowerBI安装软件包,并且我一直收到此错误:

    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. 不确定为什么会失败,我之前从未遇到过包管理器控制台的问题。

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 在我的web.config中,这段代码不存在

<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: 只需在<system.web> </system.web>标头之间添加即可使安装正常工作,现在我的web.config具有以下代码:

<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. 我会留下这个以防其他人有同样的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM