2

I have looked through AWS CodeBuild documentation and have googled this question in various forms, but haven't found anything relevant.

I have an ASP.NET 4 MVC application, that targets .NET Framework 4.5.2. And the big idea is to deploy this application automatically from git repository to several windows machines.

I have scripts that use AWS CLI and AWS CodeDeploy to build the application and deploy it from my dev-machine to our servers. These scripts work fine.

The next step, that I can't figure out how to do, is to use AWS CodeBuild (or maybe I should use some other AWS thing or not AWS thing) in order to pull code from git repository and run my build scripts (not on my dev-machine). But it seems like CodeBuild is able to work only with Unix/Linux environments and not with Windows + .NET Framework.

The question is: Is there a way to use CodeBuild or some other AWS service in order to pull code from git repository and build ASP.NET 4 application that targets .NET Framework and how to do this?

2 Answers 2

4

Amazon, as of May-2018, supports Windows hosts. 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
Sign up to request clarification or add additional context in comments.

2 Comments

How are you deploying your application to windows EC2 instance? using aws code deploy from aws pipeline ? Could you please provide me more details on this?? I am trying to deploy my .Net framework based application to windows EC2 instance using aws code pipeline. I am able build it using custom vs studio build tools 2017 docker image but trying to figure it out, how to deploy publish folder to my IIS EC2 instance
Correct, we were using Code Build, Code Pipeline, and Code Deploy to Windows EC2 instances. There is a decent article from AWS on deploying via VSTS, but the trigger can just as easily be Code Pipeline.
0

Unless something has changed very recently, AWS CodeBuild only supports .net Core applications, not the traditional .net framework.

You could install Jenkins (or other similar tool) on an EC2 instance and integrate it into your process, but that will require you to do most of the work yourself in terms of getting it working.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.