{"id":841,"date":"2017-08-28T18:58:14","date_gmt":"2017-08-28T17:58:14","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=841"},"modified":"2019-09-12T13:38:01","modified_gmt":"2019-09-12T12:38:01","slug":"net-core-development","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/net-core-development\/","title":{"rendered":".Net Core development"},"content":{"rendered":"<p><span style=\"font-family: 'courier new', courier, monospace;\">Source:&nbsp;<a href=\"https:\/\/github.com\/dotnet\/core\">https:\/\/github.com\/dotnet\/core<\/a><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">Learn: <a href=\"https:\/\/docs.microsoft.com\/nl-nl\/dotnet\/core\/\">https:\/\/docs.microsoft.com\/nl-nl\/dotnet\/core\/<\/a><\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Windows<\/strong><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">Download: <a href=\"https:\/\/www.microsoft.com\/net\/download\/core\">https:\/\/www.microsoft.com\/net\/download\/core<\/a><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Arch Linux<\/strong><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">pacaur -S dotnet-sdk-2.0<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Create new Solution file<\/strong><\/span><\/p>\n<pre><span style=\"font-family: 'courier new', courier, monospace;\"><span style=\"background-color: #fafafa; color: #000000; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; font-size: 14px; white-space: pre;\">dotnet new sln<\/span><\/span><\/pre>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Start new project<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">mkdir $application_name<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">cd $application_name<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet new webapi<\/span><\/p>\n<pre>Add project to solution\ndotnet sln add $project<\/pre>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Reset all nuget packages:<\/strong><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet nuget locals &#8211;clear all<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace; color: #999999;\">info : Clearing NuGet HTTP cache: C:\\Users\\kooiman\\AppData\\Local\\NuGet\\v3-cache<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace; color: #999999;\">info : Clearing NuGet global packages folder: C:\\Users\\kooiman\\.nuget\\packages\\<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace; color: #999999;\">info : Clearing NuGet Temp cache: C:\\Users\\kooiman\\AppData\\Local\\TempLnk\\NuGetScratch<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace; color: #999999;\">info : Clearing NuGet plugins cache: C:\\Users\\kooiman\\AppData\\Local\\NuGet\\plugins-cache<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace; color: #999999;\">info : Local resources cleared.<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet restore &#8211;no-cache &#8211;force<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>List project templates:<\/strong> dotnet new<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>New WebApi project:<\/strong> dotnet new webapi<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Install\/restore NuGet packages:<\/strong> dotnet restore<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Build project:<\/strong> dotnet build -c Debug<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Run project:<\/strong> dotnet run<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>See it running:<\/strong> <a href=\"http:\/\/localhost:5000\/api\/values\">http:\/\/localhost:5000\/api\/values<\/a><\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Add NuGet package:<\/strong> dotnet add package Microsoft.EntityFrameworkCore<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Add Reference:<\/strong> dotnet add reference lib1\/lib1.csproj lib2\/lib2.csproj<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Command help<\/strong><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet add &#8211;help<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet add package &#8211;help<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet add reference &#8211;help<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Unit Testing<\/strong><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">Install nuget package: dotnet add package&nbsp;Microsoft.NET.Test.Sdk<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Run unit test:<\/strong> dotnet test<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">Debug project?<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Build release:<\/strong> dotnet build -c Release<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Create package:<\/strong> dotnet pack &nbsp;~\/projects\/app1\/project.csproj \/p:PackageVersion=2.1.0 &#8211;no-build &#8211;output packages\/<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Publish nuget package:<\/strong> dotnet nuget push packages\/*.nupkg -s http:\/\/server.com:123\/ -k &lt;API_KEY&gt;<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\"><strong>Publish package:<\/strong> dotnet publish ~\/projects\/app1\/project.csproj &#8211;framework netcoreapp2.0<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Example<\/strong><\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">mkdir WebApiClient2<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">cd WebApiClient2<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">dotnet new classlib -f netcoreapp2.0<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">dotnet add package Newtonsoft.Json<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">dotnet add package System.Net.Http<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">dotnet build -c Debug<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">:: dotnet build -c Release<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">dotnet pack -c Release \/p:PackageVersion=2.1.0 -o packages\/<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">:: dotnet pack -c Release \/p:PackageVersion=2.1.0 &#8211;no-build -o packages\/<\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\"><strong>Git<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'courier new', courier, monospace;\">Initialize git: git init<\/span><br>\n<span style=\"font-family: 'courier new', courier, monospace;\">Add git ignore file: .gitignore<\/span><\/p>\n<p><strong><span style=\"font-family: 'courier new', courier, monospace;\">Entity Framework<\/span><\/strong><\/p>\n<p>Source : <a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx\">http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx<\/a><\/p>\n<pre class=\"console\" style=\"box-sizing: border-box; font-family: SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace; font-size: 14px; margin-top: 0px; margin-bottom: 1rem; overflow: auto; display: block; color: #212529; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 300; letter-spacing: normal; orphans: 2; text-align: justify; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #ffffff; text-decoration-style: initial; text-decoration-color: initial;\">dotnet ef database drop [arguments] [options]\ndotnet ef dbcontext update [arguments] [options]\n\ndotnet ef dbcontext info [arguments] [options]\ndotnet ef dbcontext list [arguments] [options]\ndotnet ef dbcontext scaffold [arguments] [options]\n\ndotnet ef migrations add [arguments] [options]\ndotnet ef migrations list [arguments] [options]\ndotnet ef migrations remove [arguments] [options]\n\n\n<\/pre>\n<table class=\"table table-striped table-bordered table-condensed\" style=\"height: 216px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"height: 48px; width: 77px;\" rowspan=\"2\"><span style=\"font-family: 'courier new', courier, monospace;\">Database<\/span><\/td>\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#database-drop\">drop<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Drops the database.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#database-update\">update<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Updates the database to a specified migration.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 72px; width: 77px;\" rowspan=\"3\"><span style=\"font-family: 'courier new', courier, monospace;\">DbContext<\/span><\/td>\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#dbcontext-info\">info<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Gets information about a DbContext type.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#dbcontext-list\">list<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Lists available DbContext types.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#dbcontext-scaffold\">scaffold<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Scaffolds a DbContext and entity types for a database.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 96px; width: 77px;\" rowspan=\"4\"><span style=\"font-family: 'courier new', courier, monospace;\">Migrations<\/span><\/td>\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#migrations-add\">add<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Adds a new migration.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#migrations-list\">list<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Lists available migrations.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#migrations-remove\">remove<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Removes the last migration.<\/span><\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"height: 24px; width: 56px;\"><span style=\"font-family: 'courier new', courier, monospace;\"><a href=\"http:\/\/www.entityframeworktutorial.net\/efcore\/cli-commands-for-ef-core-migration.aspx#migrations-script\">script:<\/a><\/span><\/td>\n<td style=\"height: 24px; width: 380px;\"><span style=\"font-family: 'courier new', courier, monospace;\">Generates a SQL script from migrations.<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n\n<p><a href=\"https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/host-and-deploy\/linux-nginx?view=aspnetcore-2.2\">https:\/\/docs.microsoft.com\/en-us\/aspnet\/core\/host-and-deploy\/linux-nginx?view=aspnetcore-2.2<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source:&nbsp;https:\/\/github.com\/dotnet\/core Learn: https:\/\/docs.microsoft.com\/nl-nl\/dotnet\/core\/ Windows Download: https:\/\/www.microsoft.com\/net\/download\/core Arch Linux pacaur -S dotnet-sdk-2.0 Create new Solution file dotnet new sln Start new project mkdir $application_name cd $application_name dotnet new webapi Add project to solution dotnet sln add $project Reset all nuget packages: dotnet nuget locals &#8211;clear all info : Clearing NuGet HTTP cache: C:\\Users\\kooiman\\AppData\\Local\\NuGet\\v3-cache info : Clearing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-841","post","type-post","status-publish","format-standard","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/841","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/comments?post=841"}],"version-history":[{"count":26,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/841\/revisions"}],"predecessor-version":[{"id":2577,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/841\/revisions\/2577"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=841"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=841"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=841"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}