ASP.NET Core op Cloud9
Chapeau
Installeren
Bron: Install for Ubuntu 14.04, 16.04, 16.10 & Linux Mint 17
- Maak een nieuwe workspace op Cloud9 en kies als type Empty
- check de geïnstalleerde versie van Ubuntu met:
lsb_release -a - Volg de instructies van de Microsoft website. Je moet alleen vooraleer je de .NET Core pakketten download het volgende pakket toevoegen:
sudo apt-get install apt-transport-https
- Filmpje: Douglas Starnes, ASP.NET Core 1.0 on Cloud 9, Jul 29, 2016
- Ik gebruik niet Yo om een template te genereren maar dotnet-new waarmee je een nieuw .NET Core project kan maken in de openstaande directory:
- Create a new .NET Core project:
mkdir aspnetcoreapp
cd aspnetcoreapp
dotnet new -t web
- Restore the packages:
dotnet restore
- Run the app (the dotnet run command will build the app when it's out of date):
dotnet run
- Browse to
http://localhost:5000
; deze poort is op Cloud9 niet beschikbaar je moet de program.cs bestand wijzigen:using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Hosting; namespace WebApplication { public class Program { public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup<Startup>() .UseUrls("http://0.0.0.0:8080") .Build(); host.Run(); } } }
- Create a new .NET Core project:
ASPNETCORE_ENVIRONMENT is an environment variable (and AFAIK) not a switch to the dotnet cli.
So what you would do is set it prior to using the tool:
rem Windows
C:\> set ASPNETCORE_ENVIRONMENT=Development
C:\> dotnet ...
rem Unix
$ export ASPNETCORE_ENVIRONMENT=Development
$ dotnet ...
Paragraaf
2017-03-08 14:05:51