This post is to help those who encounter issue when they deploy their .net core in Aws Ec2 using Visual studio.
Yes you can use visual studio to deploy your app in Aws. You can also follow the zip method explained here
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/dotnet-core-tutorial.html
The problem is that you may encounter issue on the framework version. Aws sample is using dotnet core 3.0.100
You will have the following errors:
Unable to locate application dependencies. Ensure that the versions of Microsoft.NetCore.App and Microsoft.AspNetCore.App targeted by the application are installed.
If you go deeper in your event viewer you can find more details such as:
Message: It was not possible to find any compatible framework version
The specified framework ‘Microsoft.AspNetCore.App’, version ‘3.1.0’ was not found.
- The following frameworks were found:
2.1.13 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.1.14 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.2.8 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
3.0.0 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Description: A .NET Core application failed.
Application: WaridDesk.WorlVovinam.exe
Path: C:\inetpub\AspNetCoreWebApps\app\WaridDesk.WorlVovinam.exe
Message: It was not possible to find any compatible framework version
The specified framework ‘Microsoft.AspNetCore.App’, version ‘3.1.0’ was not found.
- The following frameworks were found:
2.1.13 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.1.14 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
2.2.8 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
3.0.0 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The .NET Core frameworks can be found at: https://dotnet.microsoft.com/download/dotnet-core/3.1
After you download the version you can install it in your Ec2 machine . Then your app should be able to run