Directory
- RELATED LINKS
- dotnet command
- VS Code Hello World
- Web Hello World
- Summarize
Actually, this article was written last month.
It's just that
However, do not forget the beginner's mind party must always
RELATED LINKS
Learn. NET Core
Http://asp.net/core
Down. NET Core
Https://www.microsoft.com/net/core
Doc. NET Core
Https://docs.asp.net/en/latest/getting-started.html
dotnet command
mkdir Hwapp--Create a directory Hwapp
CD Hwapp--Open Directory Hwapp
dotnet New-Create project (Program.cs + Project.json)
dotnet Restore--restoring dependency (Project.lock.json)
dotnet Build--Compile project (obj folder and Bin folder)
Dotnet Run-Runs the project (execution Bin\debug\projectname.dll)
Dotnet-h View Help
Command line run Hello World
Cmd
- mkdir Hwapp--Create a directory Hwapp
- CD Hwapp--Open Directory Hwapp
- dotnet New-Create project (Program.cs + Project.json)
- dotnet Restore--restoring dependency (Project.lock.json)
- Dotnet Run-Runs the project (execution Bin\debug\projectname.dll)
VS Code Run Hello World
- Continue with the example above to open the folder
- Press F5 to select. NET Core (build. Vscode\launch.json)
- Press the F5 prompt to configure (generate. Vscode\tasks.json)
The program in Launch.json needs to be configured above
"Program": "${workspaceroot}/bin/debug/<target-framework>/<project-name.dll>",
Change to the following ways
"Program": "${workspaceroot}/bin/debug/netcoreapp1.0/programname.dll",
It is important to note that it is not always useful to complete these pressed F5, confirming that C # debug is loaded
VS code in the lower right corner of the status bar will be prompted
CSharp extensions can also be manually installed
Ctrl + p:ext Install CSharp
By the end of the CSharp extension, F5 can run the program.
Ctrl + Shift + Y (Debug console):
Web Hello World
Try out the console version and experience a web version of
- Project.json adding dependencies
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final"
- dotnet Restore (F1 + dotnet Restore)
- New Startup class
Using microsoft.aspnetcore.builder;using microsoft.aspnetcore.hosting;using Microsoft.aspnetcore.http;namespace consoleapplication{public class Startup {public void Configure (Iapplicationbuilder app) { app . Run (context = { return context. Response.writeasync ("Hello from ASP. core!");}}}
public static void Main (string[] args) { Console.WriteLine ("Hello world!"); /using Microsoft.AspNetCore.Hosting;
var host = new Webhostbuilder () . Usekestrel () . Usestartup<startup> () . Build (); Host. Run (); }
- F5 Access Http://localhost:5000/
Summarize
Disadvantages:
- Need to download more from SDK + ext CSharp + restore
- Debugging speed feeling is still relatively slow
- Chrome Access Web address display cannot be accessed
Advantages:
- Cross-platform
- Lightweight
[Core]. Net Core Road (1) Hello World