适用于.net控制台应用程序的AWS CodeBuild失败并显示CommandNotFoundException

时间:2019-06-10 05:08:04

标签: aws-codepipeline aws-codebuild

我正在在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 Studio\2017\Community\MSBuild\15.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   Studio\2017\Community\MSBuild\15.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 Studio\2017\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 Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" -p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v$env:DOTNET_FRAMEWORK" $env:SOLUTION'

1 个答案:

答案 0 :(得分:0)

我终于解决了这个问题。 .net框架未安装,因此在错误以下其表明缺少mscorb.dll的错误。我刚刚升级了.net框架,并且构建成功。有关更多信息,请参阅here