.NET Core 中的构建命令出错(不知道这样的主机)

问题描述 投票:0回答:3

我正在 .NET Core 中制作一个基本的控制台应用程序,当我尝试运行命令“dotnet build -c release -r win10-x64”时,我得到了这个:

Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Retrying 'FindPackagesByIdAsyncCore' for source 'http://packagesource/FindPackagesById()?id='Microsoft.NETCore.App.Runtime.win-x64'&semVerLevel=2.0.0'.
  No such host is known.
  Retrying 'FindPackagesByIdAsyncCore' for source 'http://packagesource/FindPackagesById()?id='Microsoft.WindowsDesktop.App.Runtime.win-x64'&semVerLevel=2.0.0'.
  No such host is known.
  Retrying 'FindPackagesByIdAsyncCore' for source 'http://packagesource/FindPackagesById()?id='Microsoft.AspNetCore.App.Runtime.win-x64'&semVerLevel=2.0.0'.
  No such host is known.
  Retrying 'FindPackagesByIdAsyncCore' for source 'http://packagesource/FindPackagesById()?id='Microsoft.NETCore.App.Runtime.win-x64'&semVerLevel=2.0.0'.
  No such host is known.
  Retrying 'FindPackagesByIdAsyncCore' for source 'http://packagesource/FindPackagesById()?id='Microsoft.WindowsDesktop.App.Runtime.win-x64'&semVerLevel=2.0.0'.
  No such host is known.
  Retrying 'FindPackagesByIdAsyncCore' for source 'http://packagesource/FindPackagesById()?id='Microsoft.AspNetCore.App.Runtime.win-x64'&semVerLevel=2.0.0'.
  No such host is known.
C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : Failed to retrieve information about 'Microsoft.NETCore.App.Runtime.win-x64' from remote source 'http://packagesourc
e/FindPackagesById()?id='Microsoft.NETCore.App.Runtime.win-x64'&semVerLevel=2.0.0'. [C:\Users\steve\PlatziCSharp\PlatziCSharp.csproj]
C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): error :   No such host is known. [C:\Users\steve\PlatziCSharp\PlatziCSharp.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): error : Failed to retrieve information about 'Microsoft.NETCore.App.Runtime.win-x64' from remote source 'http://packagesourc
e/FindPackagesById()?id='Microsoft.NETCore.App.Runtime.win-x64'&semVerLevel=2.0.0'. [C:\Users\steve\PlatziCSharp\PlatziCSharp.csproj]
C:\Program Files\dotnet\sdk\3.1.201\NuGet.targets(124,5): error :   No such host is known. [C:\Users\steve\PlatziCSharp\PlatziCSharp.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:08.30## Heading ##

它似乎缺少一些依赖项,我对此很陌生,我在网上找不到任何答案 任何人都可以帮助我如何安装我缺少的东西? 过去我尝试做另一个 .NET Core 项目,但出现了同样的错误,我放弃了它,这太令人沮丧了。

.net-core build command
3个回答
0
投票
  1. 工具 > 选项... > NuGet 包管理器 > 包源, 按源添加包源https://api.nuget.org/v3/index.json
  2. tools > NuGet Package Manager > Package Manager Console 输入 dotnet Restore 命令。

0
投票
  1. 在“工具”>“选项...”>“NuGet 包管理器”>“包源”上,添加 逐个包源https://api.nuget.org/v3/index.json
  2. 重新启动 Visual Studio 并重新加载您的解决方案/项目

0
投票

这篇文章没有任何意义,请删除它。

© www.soinside.com 2019 - 2024. All rights reserved.