AWS CodeBuild 因 .net 控制台应用程序的 CommandNotFoundException 而失败

AWS CodeBuild failed with CommandNotFoundException for .net console application

我正在做关于在 AWS 上创建代码管道的 POC。我正在使用 EU-WEST-1 区域和 .net 4.5 简单的 hello world 应用程序,但在构建阶段出现以下错误

[Container] 2019/06/10 04:52:15 Running command & "C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.0\Bin\MSBuild.exe"
-p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v$env:DOTNET_FRAMEWORK" $env:SOLUTION  & : The term 'C:\Program Files (x86)\Microsoft Visual   Studio17\Community\MSBuild.0\Bin\MSBuild.exe' is not recognized as the   name of a cmdlet, function, script file, or operable program. Check the   spelling of the name, or if a path was included, verify that the path is   correct and try again.  At C:\codebuild\output\tmp\script.ps1:5 char:3 
+ & "C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBu ... 
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo          : ObjectNotFound: (C:\Program File...Bin\MSBuild.e      xe:String) [], CommandNotFoundException 
    + FullyQualifiedErrorId : CommandNotFoundException

我知道我的 YAML 中存在一些与 msbuild 路径相关的问题,但我无法弄清楚,什么?

 build:
    commands:
      - '& "C:\ProgramData\chocolatey\bin\NuGet.exe" restore $env:SOLUTION -PackagesDirectory $env:PACKAGE_DIRECTORY'
      - '& "C:\Program Files (x86)\Microsoft Visual Studio17\Community\MSBuild.0\Bin\MSBuild.exe" -p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v$env:DOTNET_FRAMEWORK" $env:SOLUTION'

我终于找到了解决这个问题的方法。 .net Framework 未安装到低于它指出 mscorb.dll 丢失的错误。我刚刚升级了 .net 框架,构建成功了。更多信息请参考here