我正在VS 2017中编写应用程序.Net Core。 使用dotnet restore命令时,我收到一条消息
Configuring...
-------------------
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.
Decompressing 100% 4774 ms
Expanding 100% 12241 ms
Failed to create prime the NuGet cache. restore failed with: 1
Restoring packages for D:\01_Toci\100_GIT\Passenger\Passenger.Api\Passenger.Api.csproj...
Restoring packages for D:\01_Toci\100_GIT\Passenger\Passenger.Infrastructure\Passenger.Infrastructure.csproj...
Restoring packages for D:\01_Toci\100_GIT\Passenger\Passenger.Core\Passenger.Core.csproj...
Lock file has not changed. Skipping lock file write. Path: D:\01_Toci\100_GIT\Passenger\Passenger.Infrastructure\obj\project.assets.json
Lock file has not changed. Skipping lock file write. Path: D:\01_Toci\100_GIT\Passenger\Passenger.Core\obj\project.assets.json
Restore completed in 337,41 ms for D:\01_Toci\100_GIT\Passenger\Passenger.Core\Passenger.Core.csproj.
Restore completed in 337,39 ms for D:\01_Toci\100_GIT\Passenger\Passenger.Infrastructure\Passenger.Infrastructure.csproj.
Lock file has not changed. Skipping lock file write. Path: D:\01_Toci\100_GIT\Passenger\Passenger.Api\obj\project.assets.json
Restore completed in 1,34 sec for D:\01_Toci\100_GIT\Passenger\Passenger.Api\Passenger.Api.csproj.
NuGet Config files used:
C:\Users\wojse\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
dotnet --info输出:
D:\01_Toci\100_GIT\Passenger\Passenger.Api>dotnet --info
.NET Command Line Tools (1.0.4)
Product Information:
Version: 1.0.4
Commit SHA-1 hash: af1e6684fd
Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.4
Microsoft .NET Core Shared Framework Host
Version : 2.0.3
Build : a9190d4a75f4a982ae4b4fa8d1a24526566c69df
我尝试了很多东西而没有任何帮助:
有人能帮助我吗? :)请
答案 0 :(得分:3)
升级到VS 15.6后我遇到了这个问题。我能够通过暂时移动SDK文件夹(C:/ Program Files / dotnet / sdk)中的1.0.4以上的所有SDK来解决这个问题。运行dotnet restore,缓存填充成功,然后移回SDK。
长期来看,我们会更新我们的global.json文件以固定更新的SDK,如前面的回复所示。
答案 1 :(得分:0)
这是1.0。*版本的.NET Core SDK(非运行时!)的问题,一旦设置了全局回退文件夹,它就不再与新的NuGet版本中引入的功能兼容了。
由于您似乎安装了2.0版本,因此可能会有一个global.json
文件固定旧版本的SDK。确保您要么固定SDK的1.1。*或2. *版本,要么根本不使用global.json
文件。您仍然可以使用较新的SDK来定位.NET Core 1.0。
答案 2 :(得分:0)
我能够通过编辑global.json并替换:
来解决这个问题gcloud auth login solved
使用:
"version": "1.0.0-rc4-004771"
请参阅:dotnet/cli issue #6758 Jon Skeet在对该问题的评论中提到了这个问题。