0

我正在开发一个在 .net 框架上的应用程序,代码在 github 上,有人可以帮助我了解 buidspec.yml 文件以及我在 CICD 构建项目的项目环境中使用的任何额外文件:

aws/codebuild/windows-base:2.0-19.11.15

buildspec.yml file
--------------------------------
version: 0.2

env:
  variables:
    SOLUTION: .\CSharpHelloWorld.sln
    PACKAGE_DIRECTORY: .\packages
    DOTNET_FRAMEWORK: 4.6.2

phases:
  build:
    commands:
      - '& "C:\ProgramData\chocolatey\bin\NuGet.exe" restore $env:SOLUTION -PackagesDirectory $env:PACKAGE_DIRECTORY'
      - '& "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" -p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v$env:DOTNET_FRAMEWORK" $env:SOLUTION'
artifacts:
  files:
    - .\CSharpHelloWorld\bin\Debug\*
-------------------------------

当代码构建发生时,会出现如下错误:

---------------------------
[Container] 2020/02/01 09:23:49 Phase complete: BUILD State: FAILED
[Container] 2020/02/01 09:23:49 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: & "C:\Program Files (x86)\MSBuild\15.0\Bin\MSBuild.exe" -p:FrameworkPathOverride="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v$env:DOTNET_FRAMEWORK" $env:SOLUTION. Reason: exit status 1
[Container] 2020/02/01 09:23:49 Entering phase POST_BUILD
------------------------------
4

1 回答 1

1

您需要创建自定义 docker 映像来构建 .Net 框架应用程序,请参见此处的示例 [ https://aws.amazon.com/blogs/devops/extending-aws-codebuild-with-custom-build-environments-for-the -网络框架/][1]

aws 构建仅适用于 .NET 核心

于 2020-03-01T00:59:44.770 回答