Is standard .net supported by AWS CodeBuild?

Viewed 3377

I'm trying to setup up a proof of concept CI/CD in AWS. I need to build a .net mvc project (not core but standard).

So what I've figured so far is that we need to define a pipeline, getting code trough a source (in my case github) and putting it in S3, then CodeBuild builds it, then CodeDeploy deploys it.

I've found posts saying building standard .net is not yet supported by the CodeBuild as it does not have the windows server option. But the post is dated and it actually has windows option right now - See picture below.

shows windows server is available

So I thought it now can support standard .net builds, but I'm having trouble to find any documentation around it. Where I stuck is actually setting up the buildspec.yml file. I have no idea how to set it up for a standard .net mvc application. The aforementioned post tells how to create the buildspec.yml but for .net core, hence not working for me.

Can anyone help me to get around this?

Or should I really go ahead and setup a jenkins server and walk from there?

3 Answers

Amazon, as of May-2018, supports Windows hosts so yes, it is possible. Combine that with the Microsoft .NET Framework Build Image, I have been able to get it working. Here is a preliminary buildspec.yml to get started with:

version: 0.2

# Assumes the image is microsoft/dotnet-framework:4.7.2-sdk or similar
phases:
  install:
    commands:
      # Below is the URL for the MSI linked from https://www.iis.net/downloads/microsoft/web-deploy
      - Invoke-WebRequest -OutFile WebDeploy_amd64_en-US.msi https://download.microsoft.com/download/0/1/D/01DC28EA-638C-4A22-A57B-4CEF97755C6C/WebDeploy_amd64_en-US.msi
      - msiexec /i WebDeploy_amd64_en-US.msi /quiet
      # MSIExec will return before it is actually done - 30s seems to work...
      - Start-Sleep 30
  pre_build:
    commands:
      - nuget restore
  build:
    commands:
      - msbuild /P:Configuration=Release /T:Build,Package

Been around a few loopholes in an attempt to achieve this myself now, the answer is not black or white I'm afraid.

AWS CodeBuild do support .net build, but I strongly advise against it because of the time cost (and pain) of a few issues.

  1. Finding and understanding the buildspec configuration is cumbersome here
  2. Fixing the missing references, (such as missing Microsoft.WebApplication.targets).

I myself ran into another bug with long filenames not being supported, who knows what comes next.

Even the workarounds have workarounds, so lets face it. Its not very good for the specific purpose of building via msbuild, whom comes to me as a big dissatisfaction.

My next attempt will be to automate direct upload of build to S3, so a localhost build and server side deploy procedure. Not what I initially had intended.

Related