Nuget无法安装特定版本

Nuget无法安装特定版本,nuget,Nuget,我能够设置自己的NuGet服务器(如上所述)。 服务器Packages文件夹包含多个版本的MyPackage,例如1.0.8.0和1.0.9.0。 当我以默认方式安装它时(没有指定版本),它将成功安装。但是当我明确地这样做的时候 Install-Package MyPackage -Version 1.0.9.0 以下消息出现错误: 安装程序包:找不到程序包“MyPackage”的版本“1.0.9.0”。 第1行字符:16 +安装包结果是MyPackage.1.0.9.0.nupkg和MyPa

我能够设置自己的NuGet服务器(如上所述)。 服务器
Packages
文件夹包含多个版本的
MyPackage
,例如1.0.8.0和1.0.9.0。 当我以默认方式安装它时(没有指定版本),它将成功安装。但是当我明确地这样做的时候

Install-Package MyPackage -Version 1.0.9.0
以下消息出现错误:

安装程序包:找不到程序包“MyPackage”的版本“1.0.9.0”。 第1行字符:16
+安装包结果是
MyPackage.1.0.9.0.nupkg
MyPackage.1.0.9.0.symbols.nupkg
的共存导致NuGet崩溃。NuGet使用OData作为传输,在OData的深处,它无法序列化/反序列化两个包,抱怨“多个根节点”。
因此,我只是从
nuget pack
命令行中删除了
-symbols
,从而禁用了调试包生成,现在一切正常。

在尝试安装
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
原来
App.config
已经损坏,可能是在升级
目标框架时损坏的。现在有两个
,而
是一个新的根元素,因此错误
是多个根元素

腐败的:

<?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>

手动固定版本:

<?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>


在Package Manager控制台中发生错误后,请尝试使用以下命令查看异常的完整堆栈跟踪:
$error[0]。exception.stacktrace
。这应该指向NuGet中出现问题的地方。我也有同样的问题,但错误消息不同。软件包安装将失败,代码为1。从同一目录中删除符号包解决了此问题!还要确保同一个库中没有具有不同名称的副本。就我而言,文件夹中有一个松散的“MyPackage.X.X.nupkg副本”。
<?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>