dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.52k stars 10.04k forks source link

Compile aspnetcore source execute .\restore.cmd error. #29353

Closed kssoftwangwg closed 3 years ago

kssoftwangwg commented 3 years ago

This may not be a security issue,But it's also an important question。

For reasons of learning and ascension,So need to Compile aspnetcore sourecode. However, there are many errors at compile time !!!. I spent a lot of time, but I still can't solve it. Please help me thanks:

On Windows PowerShell exec .\restore.cmd shows error:

图片 PS C:\Users\Administrator\Desktop\aspnetcore> .\restore.cmd Building of C# project is enabled and has dependencies on NodeJS projects. Building of NodeJS projects is enabled since node is detected in C:\Program Files. Detected JDK in C:\Users\Administrator\Desktop\aspnetcore.tools\jdk\win-x64\ (via local repo convention) Downloading RoslynTools.MSBuild 16.8.0-alpha (NETCORE_ENGINEERING_TELEMETRY=InitializeToolset) Feed does not exist.

PS C:\Users\Administrator\Desktop\aspnetcore> .\restore.cmd Building of C# project is enabled and has dependencies on NodeJS projects. Building of NodeJS projects is enabled since node is detected in C:\Program Files. Detected JDK in C:\Users\Administrator\Desktop\aspnetcore.tools\jdk\win-x64\ (via local repo convention) at Exec-Process, C:\Users\Administrator\Desktop\aspnetcore\eng\common\tools.ps1: line 79 at MSBuild-Core, C:\Users\Administrator\Desktop\aspnetcore\eng\common\tools.ps1: line 582 at InitializeToolset, C:\Users\Administrator\Desktop\aspnetcore\eng\common\tools.ps1: line 499 at , C:\Users\Administrator\Desktop\aspnetcore\build.ps1: line 384 at , : line 1 Exception calling "Start" with "0" argument(s): "系统找不到指定的文件。"

(1). I installed vs 2019: v16.8.4. I also saw BuildFromSource.md describe eng/scripts/InstallVisualStudio.ps1, but I don't know what features should be installed after exec this(InstallVisualStudio.ps1).

Here are my vs2019 installed features: 图片

What do I need to install for vs2019 after exec eng/scripts/InstallVisualStudio.ps1 ??????????????

(2). JDK : v 11.0.3 , exec ./eng/scripts/InstallJdk.ps1 after Downloaded . However, 11.0.3 is not in the environment variable, They are automatically placed in the .tools\jdk\win-x64 folder 图片 图片

(3). Git: v 2.30 installed: 图片

(4). NodeJs: v 14.15.4 installed: 图片

(5). yarn installed: 图片

(6). windows operating system version: 图片

(7). global.json ;

{
  "sdk": {
    "version": "3.1.405"
  },
  "tools": {
    "dotnet": "3.1.405",
    "runtimes": {
      "dotnet/x64": [
        "$(MicrosoftNETCoreAppInternalPackageVersion)"
      ],
      "dotnet/x86": [
        "$(MicrosoftNETCoreAppInternalPackageVersion)"
      ]
    },
    "Git": "2.22.0",
    "jdk": "11.0.3",
    "vs": {
      "version": "16.0", [16.8.4 value The same error (exec restore.cmd) ]
      "components": [
        "Microsoft.VisualStudio.Component.VC.ATL",
        "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
        "Microsoft.VisualStudio.Component.Windows10SDK.17134" [?]
      ]
    }
  },
  "msbuild-sdks": {
    "Yarn.MSBuild": "1.15.2",
    "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.20213.4",
    "Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.20213.4"
  }
}

To Reproduce

Exceptions (if any)

(NETCORE_ENGINEERING_TELEMETRY=InitializeToolset) Feed does not exist. Exception calling "Start" with "0" argument(s): "系统找不到指定的文件。"

Further technical details

kssoftwangwg commented 3 years ago

参考:https://github.com/dotnet/aspnetcore/issues/21941 解决上述报错。Thanks @dougbu;

that error occurs sometimes when eng/common/tools.ps1 can't find a VS installation meeting the requirements. It's attempting a fallback download of a package version that apparently doesn't exist. But, you shouldn't need the fallback unless your installation is incomplete.

That script executes something like

& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -version 16.6 -latest -prerelease -products * -requires Microsoft.Component.MSBuild -requires Microsoft.VisualStudio.Component.VC.ATL -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ` -requires Microsoft.VisualStudio.Component.Windows10SDK.17134 Try that out then eliminate -requires .... options to find what you're missing.