Я запускаю Visual Studio и пробовал пример консоли Hello World для ядра do tnet.
PS d:\test> dotnet nuget list source
Registered Sources:
1. Microsoft Visual Studio Offline Packages [Enabled]
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
3. Package source 1 [Enabled]
C:\Program Files\dotnet\packs
4. Package source 2 [Enabled]
C:\Program Files\dotnet\sdk\NuGetFallbackFolder
PS d:\test> dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.300
Commit: b2475c1295
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.300\
Host (useful for support):
Version: 3.1.4
Commit: 0c2e69caa6
.NET Core SDKs installed:
2.1.514 [C:\Program Files\dotnet\sdk]
3.1.300 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
В примере выдается ошибка «пакет не найден»:
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).
Пакет доступно по адресу: C: \ Program Files \ dotnet \ packs \ Microsoft.AspNetCore.App.Ref \ 3.1.3 Кроме того, если я попытаюсь изменить целевую структуру на 2.1, все будет работать нормально.
.csproj по умолчанию файл, созданный с помощью командной строки do tnet.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
</Project>
Есть что-то, что я пропустил?
РЕДАКТИРОВАТЬ: Вывод после запуска clean
PS d: \ test> do tnet чистый Microsoft (R) Build Engine версии 16.6.0
+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.
Если я просто изменю 'netcore3.1' => 'netcore2.1', и все заработает.