使用更新5和NuGet Package Manager 2.8.60610.756在Visual Studio 2013中创建一个全新的项目可以完美地安装xunit 2.1.0
------- Installing...xunit 2.1.0 -------
Attempting to resolve dependency 'xunit.core (= 2.1.0)'.
Attempting to resolve dependency 'xunit.extensibility.core (= 2.1.0)'.
Attempting to resolve dependency 'xunit.abstractions (= 2.0.0)'.
Attempting to resolve dependency 'xunit.extensibility.execution (= 2.1.0)'.
Attempting to resolve dependency 'xunit.assert (= 2.1.0)'.
Installing 'xunit.abstractions 2.0.0'.
Added file 'xunit.abstractions.dll' to folder 'xunit.abstractions.2.0.0libnet35'.
Added file 'xunit.abstractions.xml' to folder 'xunit.abstractions.2.0.0libnet35'.
Added file 'xunit.abstractions.dll' to folder 'xunit.abstractions.2.0.0libportable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS'.
Added file 'xunit.abstractions.xml' to folder 'xunit.abstractions.2.0.0libportable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS'.
Added file 'xunit.abstractions.2.0.0.nupkg' to folder 'xunit.abstractions.2.0.0'.
Successfully installed 'xunit.abstractions 2.0.0'.
Installing 'xunit.extensibility.core 2.1.0'.
Added file 'xunit.core.dll' to folder 'xunit.extensibility.core.2.1.0libdotnet'.
Added file 'xunit.core.dll.tdnet' to folder 'xunit.extensibility.core.2.1.0libdotnet'.
Added file 'xunit.core.pdb' to folder 'xunit.extensibility.core.2.1.0libdotnet'.
Added file 'xunit.core.xml' to folder 'xunit.extensibility.core.2.1.0libdotnet'.
Added file 'xunit.runner.tdnet.dll' to folder 'xunit.extensibility.core.2.1.0libdotnet'.
Added file 'xunit.runner.utility.desktop.dll' to folder 'xunit.extensibility.core.2.1.0libdotnet'.
Added file 'xunit.core.dll' to folder 'xunit.extensibility.core.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.core.dll.tdnet' to folder 'xunit.extensibility.core.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.core.pdb' to folder 'xunit.extensibility.core.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.core.xml' to folder 'xunit.extensibility.core.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.runner.tdnet.dll' to folder 'xunit.extensibility.core.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.runner.utility.desktop.dll' to folder 'xunit.extensibility.core.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.extensibility.core.2.1.0.nupkg' to folder 'xunit.extensibility.core.2.1.0'.
Successfully installed 'xunit.extensibility.core 2.1.0'.
Installing 'xunit.extensibility.execution 2.1.0'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libdnx451'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libdnx451'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libdnx451'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libdotnet'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libdotnet'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libdotnet'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libmonoandroid'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libmonoandroid'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libmonoandroid'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libmonotouch'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libmonotouch'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libmonotouch'.
Added file 'xunit.execution.desktop.dll' to folder 'xunit.extensibility.execution.2.1.0libnet45'.
Added file 'xunit.execution.desktop.pdb' to folder 'xunit.extensibility.execution.2.1.0libnet45'.
Added file 'xunit.execution.desktop.xml' to folder 'xunit.extensibility.execution.2.1.0libnet45'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libwin8'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libwin8'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libwin8'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libwp8'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libwp8'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libwp8'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libwpa81'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libwpa81'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libwpa81'.
Added file 'xunit.execution.dotnet.dll' to folder 'xunit.extensibility.execution.2.1.0libxamarinios'.
Added file 'xunit.execution.dotnet.pdb' to folder 'xunit.extensibility.execution.2.1.0libxamarinios'.
Added file 'xunit.execution.dotnet.xml' to folder 'xunit.extensibility.execution.2.1.0libxamarinios'.
Added file 'xunit.extensibility.execution.2.1.0.nupkg' to folder 'xunit.extensibility.execution.2.1.0'.
Successfully installed 'xunit.extensibility.execution 2.1.0'.
Installing 'xunit.core 2.1.0'.
Added file '_._' to folder 'xunit.core.2.1.0builddnx451'.
Added file '_._' to folder 'xunit.core.2.1.0buildmonoandroid'.
Added file '_._' to folder 'xunit.core.2.1.0buildmonotouch'.
Added file '_._' to folder 'xunit.core.2.1.0buildnet45'.
Added file 'xunit.core.props' to folder 'xunit.core.2.1.0buildportable-net45+win8+wp8+wpa81'.
Added file '_._' to folder 'xunit.core.2.1.0buildwin8'.
Added file 'xunit.core.props' to folder 'xunit.core.2.1.0buildwin81'.
Added file '_._' to folder 'xunit.core.2.1.0buildwp8'.
Added file 'xunit.core.props' to folder 'xunit.core.2.1.0buildwpa81'.
Added file '_._' to folder 'xunit.core.2.1.0buildxamarinios'.
Added file 'xunit.execution.desktop.dll' to folder 'xunit.core.2.1.0build_desktop'.
Added file 'xunit.core.2.1.0.nupkg' to folder 'xunit.core.2.1.0'.
Successfully installed 'xunit.core 2.1.0'.
Installing 'xunit.assert 2.1.0'.
Added file 'xunit.assert.dll' to folder 'xunit.assert.2.1.0libdotnet'.
Added file 'xunit.assert.pdb' to folder 'xunit.assert.2.1.0libdotnet'.
Added file 'xunit.assert.xml' to folder 'xunit.assert.2.1.0libdotnet'.
Added file 'xunit.assert.dll' to folder 'xunit.assert.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.assert.pdb' to folder 'xunit.assert.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.assert.xml' to folder 'xunit.assert.2.1.0libportable-net45+win8+wp8+wpa81'.
Added file 'xunit.assert.2.1.0.nupkg' to folder 'xunit.assert.2.1.0'.
Successfully installed 'xunit.assert 2.1.0'.
Installing 'xunit 2.1.0'.
Added file 'xunit.2.1.0.nupkg' to folder 'xunit.2.1.0'.
Successfully installed 'xunit 2.1.0'.
Adding 'xunit.abstractions 2.0.0' to ClassLibrary1.
For adding package 'xunit.abstractions 2.0.0' to project 'ClassLibrary1' that targets 'net45',
>> Assembly references are being added from 'libnet35'
Added reference 'xunit.abstractions' to project 'ClassLibrary1'
Added file 'packages.config'.
Added file 'packages.config' to project 'ClassLibrary1'
Successfully added 'xunit.abstractions 2.0.0' to ClassLibrary1.
Adding 'xunit.extensibility.core 2.1.0' to ClassLibrary1.
For adding package 'xunit.extensibility.core 2.1.0' to project 'ClassLibrary1' that targets 'net45',
>> Assembly references are being added from 'libportable-net45+win8+wp8+wpa81'
Added reference 'xunit.core' to project 'ClassLibrary1'
Added file 'packages.config'.
Successfully added 'xunit.extensibility.core 2.1.0' to ClassLibrary1.
Adding 'xunit.extensibility.execution 2.1.0' to ClassLibrary1.
For adding package 'xunit.extensibility.execution 2.1.0' to project 'ClassLibrary1' that targets 'net45',
>> Assembly references are being added from 'libnet45'
Added reference 'xunit.execution.desktop' to project 'ClassLibrary1'
Added file 'packages.config'.
Successfully added 'xunit.extensibility.execution 2.1.0' to ClassLibrary1.
Adding 'xunit.core 2.1.0' to ClassLibrary1.
For adding package 'xunit.core 2.1.0' to project 'ClassLibrary1' that targets 'net45',
>> Build files are being added from 'buildportable-net45+win8+wp8+wpa81'
Added file 'packages.config'.
Successfully added 'xunit.core 2.1.0' to ClassLibrary1.
Adding 'xunit.assert 2.1.0' to ClassLibrary1.
For adding package 'xunit.assert 2.1.0' to project 'ClassLibrary1' that targets 'net45',
>> Assembly references are being added from 'libportable-net45+win8+wp8+wpa81'
Added reference 'xunit.assert' to project 'ClassLibrary1'
Added file 'packages.config'.
Successfully added 'xunit.assert 2.1.0' to ClassLibrary1.
Adding 'xunit 2.1.0' to ClassLibrary1.
Added file 'packages.config'.
Successfully added 'xunit 2.1.0' to ClassLibrary1.
==============================
使用最新的NuGet命令行exe(2.8.60717.93)执行相同的安装步骤失败,说明它需要NuGet 3.0…
C:developmenttoolsnuget> nuget update -self
Checking for updates from https://www.nuget.org/api/v2/.
Currently running NuGet.exe 2.8.6.
NuGet.exe is up to date.
C:developmenttoolsnuget> nuget
NuGet Version: 2.8.60717.93
usage: NuGet <command> [args] [options]
Type 'NuGet help <command>' for help on a specific command.
Available commands:
config Gets or sets NuGet config values.
delete Deletes a package from the server.
help (?) Displays general help information and help information about other commands
.
install Installs a package using the specified sources. If no sources are specified
, all sources defined in the NuGet configuration file are used. If the conf
iguration file specifies no sources, uses the default NuGet feed.
list Displays a list of packages from a given source. If no sources are specifie
d, all sources defined in %AppData%NuGetNuGet.config are used. If NuGet.c
onfig specifies no sources, uses the default NuGet feed.
pack Creates a NuGet package based on the specified nuspec or project file.
push Pushes a package to the server and publishes it.
NuGet's default configuration is obtained by loading %AppData%NuGetNuGet.
config, then loading any nuget.config or .nugetnuget.config starting from
root of drive and ending in current directory.
restore Restores NuGet packages.
setApiKey Saves an API key for a given server URL. When no URL is provided API key is
saved for the NuGet gallery.
sources Provides the ability to manage list of sources located in %AppData%NuGetN
uGet.config
spec Generates a nuspec for a new package. If this command is run in the same fo
lder as a project file (.csproj, .vbproj, .fsproj), it will create a tokeni
zed nuspec file.
update Update packages to latest available versions. This command also updates NuG
et.exe itself.
For more information, visit http://docs.nuget.org/docs/reference/command-line-reference
C:developmenttoolsnuget> nuget install xunit -version 2.1.0
Attempting to resolve dependency 'xunit.core (= 2.1.0)'.
Attempting to resolve dependency 'xunit.extensibility.core (= 2.1.0)'.
Attempting to resolve dependency 'xunit.abstractions (= 2.0.0)'.
Attempting to resolve dependency 'xunit.extensibility.execution (= 2.1.0)'.
Attempting to resolve dependency 'System.Collections (= 4.0.0)'.
Attempting to resolve dependency 'System.Runtime (= 4.0.0)'.
Attempting to resolve dependency 'System.Diagnostics.Debug (= 4.0.0)'.
Attempting to resolve dependency 'System.Globalization (= 4.0.0)'.
Attempting to resolve dependency 'System.IO (= 4.0.0)'.
Attempting to resolve dependency 'System.Text.Encoding (= 4.0.0)'.
Attempting to resolve dependency 'System.Threading.Tasks (= 4.0.0)'.
Attempting to resolve dependency 'System.Linq (= 4.0.0)'.
The 'System.Linq 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.60717.93'.
C:developmenttoolsnuget>
Visual Studio根本没有提到系统库,并且使用VS2013"启用NuGet-Package还原"也可用于还原包及其依赖项,并且正在运行相同版本的NuGet.exe命令行
简单的答案是,您无法阻止NuGet.exe版本2无法使用nuget install xunit -version 2.1.0
从命令行下载xunit 2.1.0。
在VisualStudio中执行相同操作时,下载的依赖项仅限于项目的目标框架所支持的依赖项。
当您使用nuget install xunit -version 2.1.0
时,没有项目,因此没有目标框架,因此所有依赖项都被认为是兼容的,因此它们都将被下载。对于xunit 2.1.0,它的依赖项之一是System.Linq 4.0.0,它需要NuGet 3.0。
你的解决办法是:
- 请改用packages.config文件。packages.config文件将存储目标框架信息
- 使用NuGet.exe版本3