Got a similar error when trying to install EntityFramework
.
PM> Install-Package EntityFramework -Version 6.1.3
Attempting to gather dependency information for package 'EntityFramework.6.1.3' with respect to project 'Project.Data.Entities', targeting '.NETFramework,Version=v4.6.1'
Gathering dependency information took 6,19 ms
Attempting to resolve dependencies for package 'EntityFramework.6.1.3' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'EntityFramework.6.1.3'
Resolved actions to install package 'EntityFramework.6.1.3'
Found package 'EntityFramework 6.1.3' in 'C:\dev\ProjectSource\packages'.
Package 'EntityFramework.6.1.3' already exists in folder 'C:\dev\ProjectSource\packages'
Install failed. Rolling back...
Package 'EntityFramework.6.1.3' does not exist in project 'Project.Data.Entities'
Executing nuget actions took 695,25 ms
Install-Package : There are multiple root elements. Line 22, position 2.
At line:1 char:1
+ Install-Package EntityFramework -Version 6.1.3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:00:01.1494321
Turned out App.config
had become corrupt, probably when upgrading target framework
. There was now two </configuration>
and <startup>
was a new root element, therefore the error multiple root elements
.
Corrupt:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="RabbitMQ.Client" publicKeyToken="89e7d7c5feba84ce" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.6.9.0" newVersion="3.6.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
Manually fixed version:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="RabbitMQ.Client" publicKeyToken="89e7d7c5feba84ce" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.6.9.0" newVersion="3.6.9.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
$error[0].exception.stacktrace
. That should point to where in NuGet the problem is occurring. – Matt Ward