Skip to content

Instantly share code, notes, and snippets.

@onyxmaster
Last active August 17, 2017 09:22
Show Gist options
  • Save onyxmaster/92c89beaabc60d8e0babc5adbf2275c4 to your computer and use it in GitHub Desktop.
Save onyxmaster/92c89beaabc60d8e0babc5adbf2275c4 to your computer and use it in GitHub Desktop.
An Amazon Elastic Beanstalk .ebextensions config to get .NET Core 2.0 working on existing AMIs (http://xm.x-infinity.com/2017/08/net-core-20-in-aws-elasticbeanstalk.html)
files:
"C:\\Users\\Administrator\\Documents\\installnetcore2.ps1":
content: |
if (!(Test-Path -path 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.0.0\')) {
$url = "https://download.microsoft.com/download/B/1/D/B1D7D5BF-3920-47AA-94BD-7A6E48822F18/DotNetCore.2.0.0-WindowsHosting.exe"
$path = "C:\Users\Administrator\Downloads\DotNetCore.2.0.0-WindowsHosting.exe"
(New-Object System.Net.WebClient).DownloadFile($url, $path)
&$path /quiet
Start-Sleep -s 5
Remove-Item $path
}
commands:
install_netcore2:
command: powershell.exe -ExecutionPolicy ByPass -File C:\Users\Administrator\Documents\installnetcore2.ps1
<ItemGroup>
<None Include=".ebextensions\netcore2.config" CopyToPublishDirectory="preserveNewest" />
</ItemGroup>
@onyxmaster
Copy link
Author

When using AWS Toolikt for Visual Studio 2017 you can publish your ASP.NET Core apps to AWS using Elastic Beanstalk.
Unfortunately, at this time the AMIs do not support .NET Core 2.0.
Fortunately, you do not have to wait, just add netcore2.config to .ebextensions/netcore2.config in your project, and modify the .csproj as shown above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment