20 Lis

Creating ASP .NET core project in PowerShell


  1. Install YO – CLI tool for running Yeoman generators
    npm install yo -g
  2. Yeoman generator for ASP.NET 5 projects
    npm install -g generator-aspnet
  3. Install .NET Version Manager (DNVM)
    &{$Branch='dev';iex ((new-object net.webclient).DownloadString( 'https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
  4. Install .NET Core Execution Environment (DNX)
    dnvm install -r coreclr latest -u
  5. If you see script executing exception try tris
    Set-ExecutionPolicy RemoteSigned
  6. Use DNVM (.NET version manager) to list all runtime versions installed, update packages and add library path to windows user path
    clr – old .NET; coreclr – new compatible with linux etc.
    dnvm upgrade
    dnvm list
    dnvm use x.x.x-beta -r clr -arch x86 <strong>-p</strong>
  7. Create new ASP.NET project (basic) – yo->Run a generator->Aspnet
  8. Restore missing assemblies:
    dnu restore
  9. Run your basic app using dnx buildin webserver
    Console app (good to know how to run a console app):
    dnx run
    Web app (our app):
    dnx web