尝试在CICD中部署.NET应用程序

时间:2020-02-01 10:04:12

标签: .net amazon-web-services .net-framework-version aws-sdk-net

我正在使用.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
------------------------------

1 个答案:

答案 0 :(得分:1)

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

aws版本仅适用于.NET核心