我正在运行Visual Studio,并尝试使用dotnet核心的Hello World控制台示例。
PS d:\test> dotnet new console --force
The template "Console Application" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on d:\test\test.csproj...
Determining projects to restore...
d:\test\test.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Ref. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, Package source, Package source 1, Package source 2
Failed to restore d:\test\test.csproj (in 402 ms).
该示例给出了未找到包的错误:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
该软件包位于:C:\ Program Files \ dotnet \ packs \ Microsoft.AspNetCore.App.Ref \ 3.1.3 另外,如果我尝试将目标框架更改为2.1,一切正常。
由dotnet命令行创建的默认.csproj文件。
+5ff7b0c9e for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Build started 5/30/2020 6:01:58 PM.
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.71
PS d:\test> dotnet run
d:\test\test.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.App.Ref. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, Package source, Package source 1, Package source 2
The build failed. Fix the build errors and run again.
有什么我想念的吗?
编辑:干净运行后输出
PS d:\ test> dotnet干净 Microsoft(R)Build Engine版本16.6.0
train
如果我只是更改'netcore3.1'=>'netcore2.1',一切正常。
答案 0 :(得分:0)
感谢所有建议。
我发现了问题。 我的nuget来源列表没有关注者,因此该工具从未在线尝试过用于包装。
https://api.nuget.org/v3/index.json