1

I have been trying to use CodeBuild to setup a codepipeline for a .NET based application. Below are the details -

  1. Buildspec file -

version: 0.2 env: variables: PROJECT: Triyo.API DOTNET_FRAMEWORK: 4.7.2 phases: build: commands: - echo start-main-solution-build - nuget.exe restore TriyoAPI.sln - cd TriyoCore.API - msbuild $env:TriyoCore.API.csproj /p:TargetFrameworkVersion=v$env:DOTNET_FRAMEWORK /p:Configuration=Release /p:DeployIisAppPath="Default Web Site" /p:PackageAsSingleFile=false /p:OutDir=C:\codebuild\artifacts\ /t:Package artifacts: files: - '**/' discard-paths: no base-directory: 'C:\codebuild\artifacts_PublishedWebsites${env:PROJECT}_Package\Archive'*

  1. CodeBuild project was created using below link for custom environments -

https://aws.amazon.com/blogs/devops/extending-aws-codebuild-with-custom-build-environments-for-the-net-framework/

  1. When running the msbuild command using my local machine, the package compiles without issues.

  2. When running on CodeBuild using custom docker image build using instructions on link on step 2 it throws below errors -

C:\codebuild\tmp\output\src102630403\src\TriyoCore.DAL\TriyoCore.DAL.csproj" (default target) (2:2) -> (CoreCompile target) -> Repositories\BaseRepository.cs(25,24): error CS8137: Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference? [C:\codebuild\tmp\output\src102630403\src\TriyoCore.DAL\TriyoCore.DAL.csproj] Repositories\BaseRepository.cs(25,24): error CS8356: Predefined type 'System.ValueTuple2' is declared in multiple referenced assemblies: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [C:\codebuild\tmp\output\src102630403\src\TriyoCore.DAL\TriyoCore.DAL.csproj] Repositories\IBaseRepository.cs(8,9): error CS8137: Cannot define a class or member that utilizes tuples because the compiler required type 'System.Runtime.CompilerServices.TupleElementNamesAttribute' cannot be found. Are you missing a reference? [C:\codebuild\tmp\output\src102630403\src\TriyoCore.DAL\TriyoCore.DAL.csproj] Repositories\IBaseRepository.cs(8,9): error CS8356: Predefined type 'System.ValueTuple2' is declared in multiple referenced assemblies: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' and 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' [C:\codebuild\tmp\output\src102630403\src\TriyoCore.DAL\TriyoCore.DAL.csproj] 1 Warning(s) 4 Error(s) Time Elapsed 00:00:08.10 [Container] 2021/06/30 11:54:25 Command did not exit successfully msbuild $env:TriyoCore.API.csproj /p:TargetFrameworkVersion=v$env:DOTNET_FRAMEWORK /p:Configuration=Release /p:DeployIisAppPath="Default Web Site" /p:PackageAsSingleFile=false /p:OutDir=C:\codebuild\artifacts\ /t:Package exit status 1 [Container] 2021/06/30 11:54:26 Phase complete: BUILD State: FAILED [Container] 2021/06/30 11:54:26 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: msbuild $env:TriyoCore.API.csproj /p:TargetFrameworkVersion=v$env:DOTNET_FRAMEWORK /p:Configuration=Release /p:DeployIisAppPath="Default Web Site" /p:PackageAsSingleFile=false /p:OutDir=C:\codebuild\artifacts\ /t:Package. Reason: exit status 1

Ajay Malik
  • 13
  • 2
  • Resolved with comments from another stackoverflow article - https://stackoverflow.com/questions/40826704/unable-to-return-tuple-from-a-method-using-visual-studio-2017-and-c-sharp-7-0 – Ajay Malik Jun 30 '21 at 14:54

0 Answers0