{"id":3225,"date":"2020-01-22T22:42:21","date_gmt":"2020-01-22T21:42:21","guid":{"rendered":"https:\/\/solidt.eu\/site\/?p=3225"},"modified":"2023-11-27T21:46:59","modified_gmt":"2023-11-27T20:46:59","slug":"dotnet-3-1-update","status":"publish","type":"post","link":"https:\/\/solidt.eu\/site\/dotnet-3-1-update\/","title":{"rendered":"DotNet core scripting new environment"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># create new solution file\ndotnet new sln\n\n# create Class library\ndotnet new classlib\n\n# create Console Application\ndotnet new console\n\n# create NUnit 3 Test Project\ndotnet new nunit\n\n# create ASP.NET Core Web API\ndotnet new webapi\n\n# ASP.NET Core Empty\ndotnet new web\n\n# more\ndotnet new -h\n\n# add project to solution file\ndotnet sln add $Project\n\n# add references\ndotnet add $Project package $NuGetPackage\ndotnet add $Project reference $ProjectPath\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n# new solution script\n# use --dry-run to test command effects\n# use --language C# | F# | VB for creating for another language\ngit init\n# solution\ndotnet new sln -n Solution\ndotnet new gitignore\ndotnet new globaljson\ndotnet new nugetconfig\n\n# domain project\ndotnet new classlib -n Domain\ndotnet sln add Domain\n\n# unit test project\ndotnet new nunit -n Domain.Tests\ndotnet add Domain.Tests package NSubstitute\ndotnet sln add Domain.Tests\ndotnet add Domain.Tests reference Domain\n\n# wiring project\ndotnet new classlib -n Wiring\ndotnet sln add Wiring\ndotnet add Wiring reference Domain\ndotnet add Wiring package Autofac\n\n# use webapi and\/or console\n\n# webapi project\n#dotnet new webapi -n WebApi\n#dotnet sln add WebApi\n#dotnet add WebApi reference Domain\n#dotnet add WebApi reference Wiring\n\n# console project\ndotnet new console -n ConsoleApp\ndotnet sln add ConsoleApp\ndotnet add ConsoleApp reference Domain\ndotnet add ConsoleApp reference Wiring<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n# new solution script\n# use --dry-run to test command effects\n# use --language C# | F# | VB for creating for another language\ngit init\ndotnet new sln -n Solution\ndotnet new gitignore\ndotnet new globaljson\ndotnet new nugetconfig\n\ndotnet new classlib -n Domain\ndotnet sln add Domain\n\ndotnet new classlib -n Wiring\ndotnet sln add Wiring\ndotnet add Wiring reference Domain\n\ndotnet new nunit -n Domain.Tests\ndotnet sln add Domain.Tests\ndotnet add Domain.Tests reference Domain\n\ndotnet new webapi -n WebApi\ndotnet sln add WebApi\ndotnet add WebApi reference Domain\ndotnet add WebApi reference Wiring\n\ndotnet new classlib -n LogAdapter\ndotnet sln add LogAdapter\ndotnet add LogAdapter reference Domain\n\ndotnet new classlib -n ConfigAdapter\ndotnet sln add ConfigAdapter\ndotnet add ConfigAdapter reference Domain\n\ndotnet add Wiring reference LogAdapter\ndotnet add Wiring reference ConfigAdapter\n\ndotnet add Domain.Tests package NSubstitute\ndotnet add LogAdapter package log4net\ndotnet add Wiring package Autofac\ndotnet add ConfigAdapter package  Microsoft.Extensions.Configuration.Json\n\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">dotnet publish --configuration Release\n\n# From the command line, run the app: dotnet &lt;app_assembly>.dll.\n# In a browser, navigate to http:\/\/&lt;serveraddress>:&lt;port> to verify the app works on Linux locally.\n\n<\/pre>\n\n\n\n<p>A simple new console app<\/p>\n\n\n\n<div style=\"height: 250px; position:relative; margin-bottom: 50px;\" class=\"wp-block-simple-code-block-ace\"><pre class=\"wp-block-simple-code-block-ace\" style=\"position:absolute;top:0;right:0;bottom:0;left:0\" data-mode=\"powershell\" data-theme=\"monokai\" data-fontsize=\"14\" data-lines=\"Infinity\" data-showlines=\"true\" data-copy=\"false\">mkdir $projectname\ncd $projectname\ngit init\n\ndotnet new sln -n Solution\ndotnet new gitignore\ndotnet new globaljson\ndotnet new nugetconfig\n\ndotnet new console -n ConsoleApp --use-program-main\ndotnet sln add ConsoleApp\n<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>A simple new console app<\/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,4,1],"tags":[],"class_list":["post-3225","post","type-post","status-publish","format-standard","hentry","category-dotnet","category-programming","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/3225","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=3225"}],"version-history":[{"count":22,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/3225\/revisions"}],"predecessor-version":[{"id":8158,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/posts\/3225\/revisions\/8158"}],"wp:attachment":[{"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/media?parent=3225"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/categories?post=3225"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/solidt.eu\/site\/wp-json\/wp\/v2\/tags?post=3225"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}