$ dotnet --help
.NET Command Line Tools (1.0.0-preview1-002702)
Usage: dotnet [common-options] [command] [arguments]
Arguments:
[command] Thecommandtoexecute
[arguments] Arguments to pass tothecommand
Common Options (passed beforethecommand):
-v|--verbose Enable verbose output--version Display .NET CLI Version Number--info Display .NET CLI Info
Common Commands:
new Initialize a basic .NET project
restore Restore dependencies specified inthe .NET project
build Builds a .NET project
publish Publishes a .NET project for deployment (including the runtime)
run Compiles and immediately executes a .NET project
test Runs unit tests usingthe test runner specified inthe project
pack Creates a NuGet package
では、動作検証を含めて、Hello Worldアプリを作ります。
$ mkdir hello-world
$ cd hello-world
$ dotnet new
Welcome to .NET Core!
Learn more about .NET Core @ https://aka.ms/dotnet-docs. Usedotnet--help to see available commands or go to https://aka.ms/dotnet-cli-docs.
Telemetry
The .NET Core tools collectusagedatainorderto improve your experience. The datais anonymous and does notinclude commandline arguments. The datais collected by Microsoft andsharedwith the community. You can opt outof telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variableto1using your favorite shell. Read more about .NET Core tools telemetry @ https://aka.ms/dotnet-cli-telemetry.
Configuring...
A command is running toinitially populate your localpackagecache, to improve restore speed andenableoffline access. This command will take up to a minutetocompleteand will only happen once.
Decompressing 100% 1781 ms
Expanding 100% 5167 ms
Created new C# project in /home/lesw/hello-world.
$ dotnetrestorelog : Restoring packages for /home/lesw/hello-world/project.json...
log : Writing lockfileto disk. Path: /home/lesw/hello-world/project.lock.json
log : /home/lesw/hello-world/project.json
log : Restore completed in638ms.
$ dotnet run
Project hello-world (.NETCoreApp,Version=v1.0) will be compiled because expected outputs aremissing
Compiling hello-world for .NETCoreApp,Version=v1.0
Compilation succeeded.
0Warning(s)
0Error(s)
Time elapsed 00:00:00.9286845
Hello World!
$ scl enable rh-nodejs4 bash
$ scl enable rh-dotnetcore10 bash
$ yo aspnet
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--(o)--| │ marvellous ASP.NET Core │
`---------´ │ generator! │
( _´U`_ ) ╰──────────────────────────╯
/___A___\ /
| ~ |
__'.___.'__
´ ` |° ´ Y `
? What typeof application do you want tocreate?
Empty Web Application
Console Application
❯ Web Application
Web Application Basic [without Membership andAuthorization]
Web API Application
Class Library
Unit test project (xUnit.net)
Web Applicationを選択します。
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--(o)--| │ marvellous ASP.NET Core │
`---------´ │ generator! │
( _´U`_ ) ╰──────────────────────────╯
/___A___\ /
| ~ |
__'.___.'__
´ ` |° ´ Y `
? What typeof application do you want tocreate? Web Application
? Which UI framework would you liketo use? (Use arrow keys)
❯ Bootstrap (3.3.6)
Semantic UI (2.1.8)
Bootstrapを選択する。
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--(o)--| │ marvellous ASP.NET Core │
`---------´ │ generator! │
( _´U`_ ) ╰──────────────────────────╯
/___A___\ /
| ~ |
__'.___.'__
´ ` |° ´ Y `
? What typeof application do you want tocreate? Web Application
? Which UI framework would you liketo use? Bootstrap (3.3.6)
? What's the name of your ASP.NET application? (WebApplication) hwweb
アプリケーション名を確認されるので、ここではhwwebとします。
? What's the name of your ASP.NET application? hwweb
create hwweb/Dockerfile
create hwweb/.bowerrc
create hwweb/.gitignore
create hwweb/appsettings.json
create hwweb/bower.json
create hwweb/bundleconfig.json
create hwweb/Program.cs
create hwweb/project.json
create hwweb/README.md
create hwweb/Startup.cs
create hwweb/Controllers/AccountController.cs
create hwweb/Controllers/HomeController.cs
create hwweb/Controllers/ManageController.cs
create hwweb/Data/Migrations/00000000000000_CreateIdentitySchema.Designer.cs
create hwweb/Data/Migrations/00000000000000_CreateIdentitySchema.cs
create hwweb/Data/Migrations/ApplicationDbContextModelSnapshot.cs
create hwweb/Data/ApplicationDbContext.cs
create hwweb/Models/ApplicationUser.cs
create hwweb/Models/AccountViewModels/ExternalLoginConfirmationViewModel.cs
create hwweb/Models/AccountViewModels/ForgotPasswordViewModel.cs
create hwweb/Models/AccountViewModels/LoginViewModel.cs
create hwweb/Models/AccountViewModels/RegisterViewModel.cs
create hwweb/Models/AccountViewModels/ResetPasswordViewModel.cs
create hwweb/Models/AccountViewModels/SendCodeViewModel.cs
create hwweb/Models/AccountViewModels/VerifyCodeViewModel.cs
create hwweb/Models/ManageViewModels/AddPhoneNumberViewModel.cs
create hwweb/Models/ManageViewModels/ChangePasswordViewModel.cs
create hwweb/Models/ManageViewModels/ConfigureTwoFactorViewModel.cs
create hwweb/Models/ManageViewModels/FactorViewModel.cs
create hwweb/Models/ManageViewModels/IndexViewModel.cs
create hwweb/Models/ManageViewModels/ManageLoginsViewModel.cs
create hwweb/Models/ManageViewModels/RemoveLoginViewModel.cs
create hwweb/Models/ManageViewModels/SetPasswordViewModel.cs
create hwweb/Models/ManageViewModels/VerifyPhoneNumberViewModel.cs
create hwweb/Properties/launchSettings.json
create hwweb/Services/IEmailSender.cs
create hwweb/Services/ISmsSender.cs
create hwweb/Services/MessageServices.cs
create hwweb/Views/Account/ConfirmEmail.cshtml
create hwweb/Views/Account/ExternalLoginConfirmation.cshtml
create hwweb/Views/Account/ExternalLoginFailure.cshtml
create hwweb/Views/Account/ForgotPassword.cshtml
create hwweb/Views/Account/ForgotPasswordConfirmation.cshtml
create hwweb/Views/Account/Lockout.cshtml
create hwweb/Views/Account/Login.cshtml
create hwweb/Views/Account/Register.cshtml
create hwweb/Views/Account/ResetPassword.cshtml
create hwweb/Views/Account/ResetPasswordConfirmation.cshtml
create hwweb/Views/Account/SendCode.cshtml
create hwweb/Views/Account/VerifyCode.cshtml
create hwweb/Views/Home/About.cshtml
create hwweb/Views/Home/Contact.cshtml
create hwweb/Views/Home/Index.cshtml
create hwweb/Views/Manage/AddPhoneNumber.cshtml
create hwweb/Views/Manage/ChangePassword.cshtml
create hwweb/Views/Manage/Index.cshtml
create hwweb/Views/Manage/ManageLogins.cshtml
create hwweb/Views/Manage/SetPassword.cshtml
create hwweb/Views/Manage/VerifyPhoneNumber.cshtml
create hwweb/Views/Shared/Error.cshtml
create hwweb/Views/Shared/_Layout.cshtml
create hwweb/Views/Shared/_LoginPartial.cshtml
create hwweb/Views/Shared/_ValidationScriptsPartial.cshtml
create hwweb/Views/_ViewImports.cshtml
create hwweb/Views/_ViewStart.cshtml
create hwweb/wwwroot/css/site.css
create hwweb/wwwroot/css/site.min.css
create hwweb/wwwroot/favicon.ico
create hwweb/wwwroot/images/banner1.svg
create hwweb/wwwroot/images/banner2.svg
create hwweb/wwwroot/images/banner3.svg
create hwweb/wwwroot/images/banner4.svg
create hwweb/wwwroot/js/site.js
create hwweb/wwwroot/js/site.min.js
create hwweb/web.config
I'm all done. Running bower install for you to install the required dependencies. If this fails, try running the command yourself.
bower cached https://github.com/twbs/bootstrap.git#3.3.6
bower validate 3.3.6 against https://github.com/twbs/bootstrap.git#3.3.6
bower cached https://github.com/jquery/jquery-dist.git#2.2.3
bower validate 2.2.3 against https://github.com/jquery/jquery-dist.git#2.2.3
bower cached https://github.com/jzaefferer/jquery-validation.git#1.15.0
bower validate 1.15.0 against https://github.com/jzaefferer/jquery-validation.git#1.15.0
bower cached https://github.com/aspnet/jquery-validation-unobtrusive.git#3.2.6
bower validate 3.2.6 against https://github.com/aspnet/jquery-validation-unobtrusive.git#3.2.6
bower install jquery-validation-unobtrusive#3.2.6
bower install jquery#2.2.3
bower install jquery-validation#1.15.0
bower install bootstrap#3.3.6
jquery-validation-unobtrusive#3.2.6 wwwroot/lib/jquery-validation-unobtrusive
├── jquery#2.2.3
└── jquery-validation#1.15.0
jquery#2.2.3 wwwroot/lib/jquery
jquery-validation#1.15.0 wwwroot/lib/jquery-validation
└── jquery#2.2.3
Your project is now created, you can use the following commands to get going
cd "hwweb"
dotnet restore
dotnet build (optional, build will also happen when it's run)
dotnet ef database update (to create the SQLite database for the project)
dotnet run
あとは書いてある手順どおりです。
$ cd hwweb
$ dotnet restorelog : Restoring packages for /home/ishisaka/src/hwweb/project.json...
log : Installing Microsoft.EntityFrameworkCore.Sqlite.Design 1.0.0.
log : Restoring packages for tool 'BundlerMinifier.Core'in /home/ishisaka/src/hwweb/project.json...
log : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools'in /home/ishisaka/src/hwweb/project.json...
log : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools'in /home/ishisaka/src/hwweb/project.json...
log : Restoring packages for tool 'Microsoft.EntityFrameworkCore.Tools'in /home/ishisaka/src/hwweb/project.json...
log : Restoring packages for tool 'Microsoft.Extensions.SecretManager.Tools'in /home/ishisaka/src/hwweb/project.json...
log : Restoring packages for tool 'Microsoft.VisualStudio.Web.CodeGeneration.Tools'in /home/ishisaka/src/hwweb/project.json...
log : Writing lockfileto disk. Path: /home/ishisaka/src/hwweb/project.lock.json
log : /home/ishisaka/src/hwweb/project.json
log : Restore completed in19044ms.
$ dotnetbuildProject hwweb (.NETCoreApp,Version=v1.0) will be compiled because projectisnotsafefor incremental compilation. Use--build-profile flag for more information.
Compiling hwweb for .NETCoreApp,Version=v1.0
Bundling with configuration from /home/ishisaka/src/hwweb/bundleconfig.json
Processing wwwroot/css/site.min.css
Bundled
Minified
Processing wwwroot/js/site.min.js
Bundled
Compilation succeeded.
0Warning(s)
0Error(s)
Time elapsed 00:00:06.2161396
(The compilation time can be improved. Run "dotnet build --build-profile"for more information)
$ dotnet ef databaseupdateProject hwweb (.NETCoreApp,Version=v1.0) will be compiled because projectisnotsafefor incremental compilation. Use--build-profile flag for more information.
Compiling hwweb for .NETCoreApp,Version=v1.0
Bundling with configuration from /home/ishisaka/src/hwweb/bundleconfig.json
Processing wwwroot/css/site.min.css
Bundled
Minified
Processing wwwroot/js/site.min.js
Compilation succeeded.
0Warning(s)
0Error(s)
Time elapsed 00:00:03.5448853
(The compilation time can be improved. Run "dotnet build --build-profile"for more information)
Done.
$ dotnet run
Project hwweb (.NETCoreApp,Version=v1.0) will be compiled because projectisnotsafefor incremental compilation. Use--build-profile flag for more information.
Compiling hwweb for .NETCoreApp,Version=v1.0
Bundling with configuration from /home/ishisaka/src/hwweb/bundleconfig.json
Processing wwwroot/css/site.min.css
Bundled
Minified
Processing wwwroot/js/site.min.js
Compilation succeeded.
0Warning(s)
0Error(s)
Time elapsed 00:00:03.5691780
(The compilation time can be improved. Run "dotnet build --build-profile"for more information)
info: Microsoft.Extensions.DependencyInjection.DataProtectionServices[0]
User profile is available. Using'/home/ishisaka/.aspnet/DataProtection-Keys'askey repository; keys will not be encrypted at rest.
Hosting environment: Production
Content root path: /home/ishisaka/src/hwweb
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
コメント