{"action":"created","comment":{"url":"https://api.github.com/repos/dotnet/core-docs/pulls/comments/52104198","id":52104198,"diff_hunk":"@@ -0,0 +1,586 @@\n+# Writing Console Apps: A Step by Step Guide\n+\n+This guide will show you how to use the .NET CLI tooling to build cross-platform console apps incrementally.  It will start with the most basic console app and eventually span multiple projects, including testing.\n+\n+If you're unfamiliar with the .NET CLI toolset, read [the overview](overview.md).  It's also helpful to have an understanding of the [console app paradigm](paradigm.md) and how [native binary compilation](single-binaries.md) works.\n+\n+## Prerequisites\n+\n+Before you begin, ensure you have the [latest .NET CLI tooling](http://dotnet.github.io/getting-started/).  You'll also need a text editor.\n+\n+## Hello, Console App!\n+\n+First, navigate to or create a new folder with a name you like.  \"Hello\" is the name chosen for the sample code, which can be found [here](https://github.com/dotnet/core-docs/samples/core-projects/console-apps/Hello).\n+\n+Open up a command prompt and type the following:\n+\n+```\n+$ dotnet new\n+$ dotnet restore\n+$ dotnet compile\n+```\n+\n+Let's do a quick walkthrough:\n+\n+1. `$ dotnet init`\n+\n+   `dotnet init` created an up-to-date `project.json` file with NuGet dependencies necessary to build a console app.  It also created a `Program.cs`, a basic file containing the entry point for the application.\n+   \n+   `project.json`:\n+   ```javascript\n+   {\n+        \"version\": \"1.0.0-*\",\n+        \"compilationOptions\": {\n+            \"emitEntryPoint\": true\n+        },\n+    \n+        \"dependencies\": {\n+            \"Microsoft.NETCore.Runtime\": \"1.0.1-beta-*\",\n+            \"System.IO\": \"4.0.11-beta-*\",\n+            \"System.Console\": \"4.0.0-beta-*\",\n+            \"System.Runtime\": \"4.0.21-beta-*\"\n+        },\n+    \n+        \"frameworks\": {\n+            \"dnxcore50\": { }\n+        }\n+   }\n+   ```\n+   `Program.cs`:\n+   ```csharp\n+   using System;\n+\n+   namespace ConsoleApplication\n+   {\n+       public class Program\n+       {\n+           public static void Main(string[] args)\n+           {\n+               Console.WriteLine(\"Hello World!\");\n+           }\n+       }\n+   }\n+   ```\n+\n+2. `$ dotnet restore`\n+\n+   `dotnet restore` analyzed the `project.json` file, downloaded the dependencies stated in the file (or grabbed them from a cache on your machine), and wrote the `project.lock.json` file.  The `project.lock.json` file is necessary to be able to compile and run.\n+   \n+   The `project.lock.json` file is a persisted and complete set of NuGet dependencies and other information describing an app.  This file is read by other tools, such as `dotnet compile` and `dotnet run`, enabling them to process the source code with a correct set of NuGet dependencies and binding resolutions.\n+   \n+3. `$ dotnet run`\n+\n+   `dotnet compile` compiled the source in Intermediate Language (IL) and generated an executable shim and a `Hello.dll` `.dll` file which contains the IL.\n+   \n+You can now invoke the executable.\n+\n+```\n+$ /bin/Debug/dnxcore50/Hello.exe\n+Hello, World!\n+```\n+\n+### Other ways to compile\n+\n+Let's try compiling `dotnet run` to compile and execute the code without generating any build artifacts.  Note that although this has use (mainly by ASP.NET internally), it's not a recommended way to run build and run console applications.\n+\n+```\n+$ dotnet run\n+Hello, World!\n+```\n+\n+Let's try compiling a native binary instead.\n+\n+```\n+$ dotnet compile --native","path":"docs/console/incremental-guide.md","position":94,"original_position":94,"commit_id":"3d1e5cadd73e55fef230628baf49480c080aa329","original_commit_id":"3d1e5cadd73e55fef230628baf49480c080aa329","user":{"login":"blackdwarf","id":3115004,"avatar_url":"https://avatars.githubusercontent.com/u/3115004?v=3","gravatar_id":"","url":"https://api.github.com/users/blackdwarf","html_url":"https://github.com/blackdwarf","followers_url":"https://api.github.com/users/blackdwarf/followers","following_url":"https://api.github.com/users/blackdwarf/following{/other_user}","gists_url":"https://api.github.com/users/blackdwarf/gists{/gist_id}","starred_url":"https://api.github.com/users/blackdwarf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/blackdwarf/subscriptions","organizations_url":"https://api.github.com/users/blackdwarf/orgs","repos_url":"https://api.github.com/users/blackdwarf/repos","events_url":"https://api.github.com/users/blackdwarf/events{/privacy}","received_events_url":"https://api.github.com/users/blackdwarf/received_events","type":"User","site_admin":false},"body":"`dotnet build`","created_at":"2016-02-06T16:53:48Z","updated_at":"2016-02-06T16:53:48Z","html_url":"https://github.com/dotnet/core-docs/pull/190#discussion_r52104198","pull_request_url":"https://api.github.com/repos/dotnet/core-docs/pulls/190","_links":{"self":{"href":"https://api.github.com/repos/dotnet/core-docs/pulls/comments/52104198"},"html":{"href":"https://github.com/dotnet/core-docs/pull/190#discussion_r52104198"},"pull_request":{"href":"https://api.github.com/repos/dotnet/core-docs/pulls/190"}}},"pull_request":{"url":"https://api.github.com/repos/dotnet/core-docs/pulls/190","id":52902615,"html_url":"https://github.com/dotnet/core-docs/pull/190","diff_url":"https://github.com/dotnet/core-docs/pull/190.diff","patch_url":"https://github.com/dotnet/core-docs/pull/190.patch","issue_url":"https://api.github.com/repos/dotnet/core-docs/issues/190","number":190,"state":"open","locked":false,"title":"Step by Step Console app article","user":{"login":"cartermp","id":6309070,"avatar_url":"https://avatars.githubusercontent.com/u/6309070?v=3","gravatar_id":"","url":"https://api.github.com/users/cartermp","html_url":"https://github.com/cartermp","followers_url":"https://api.github.com/users/cartermp/followers","following_url":"https://api.github.com/users/cartermp/following{/other_user}","gists_url":"https://api.github.com/users/cartermp/gists{/gist_id}","starred_url":"https://api.github.com/users/cartermp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cartermp/subscriptions","organizations_url":"https://api.github.com/users/cartermp/orgs","repos_url":"https://api.github.com/users/cartermp/repos","events_url":"https://api.github.com/users/cartermp/events{/privacy}","received_events_url":"https://api.github.com/users/cartermp/received_events","type":"User","site_admin":false},"body":"This the first half of what was discussed in #180.\r\n\r\nIt covers building console applications in an incremental fashion: first the basic setup with `dotnet init` with native  and non-native compilation, extending the console app to do more than \"Hello, World!\", then adding multiple files, then putting files in folders, and finally a multi-project system with unit tests.\r\n\r\nTo be addressed:\r\n\r\n* Embedding sample code when embedding with line number ranges is supported\r\n* Fixing some of the links which point to samples or other articles\r\n* Any changes to the .NET CLI toolchain when they're complete (such as `dotnet init --> dotnet new`)\r\n\r\nThis has also been written with the following assumptions:\r\n\r\n1. The \"Overview and moving pieces\" explains the dotnet driver fairly comprehensively\r\n2. The \"Console app paradigm\" article explains concepts such as the shared runtime, self-contained runtime, what it means to have a single binary, etc\r\n3. The \"Creating single binaries with native compilation\" article explains what happens when you do a native compilation and provides examples of the different ways you can natively compile\r\n\r\nThat means that this is really more of a \"how\" rather than \"what\" article.  I didn't go into much depth at all about what each thing being used meant, and instead focused on what people might want to know how to do with the toolchain.\r\n\r\n/cc @blackdwarf @mairaw @richlander @BethMassi @matthewreily @piotrpMSFT ","created_at":"2015-12-07T21:22:17Z","updated_at":"2016-02-06T16:53:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3cbb7b0d1f4de85d50208ac3aedcf3b4f545822e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dotnet/core-docs/pulls/190/commits","review_comments_url":"https://api.github.com/repos/dotnet/core-docs/pulls/190/comments","review_comment_url":"https://api.github.com/repos/dotnet/core-docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dotnet/core-docs/issues/190/comments","statuses_url":"https://api.github.com/repos/dotnet/core-docs/statuses/3d1e5cadd73e55fef230628baf49480c080aa329","head":{"label":"cartermp:console-app-article","ref":"console-app-article","sha":"3d1e5cadd73e55fef230628baf49480c080aa329","user":{"login":"cartermp","id":6309070,"avatar_url":"https://avatars.githubusercontent.com/u/6309070?v=3","gravatar_id":"","url":"https://api.github.com/users/cartermp","html_url":"https://github.com/cartermp","followers_url":"https://api.github.com/users/cartermp/followers","following_url":"https://api.github.com/users/cartermp/following{/other_user}","gists_url":"https://api.github.com/users/cartermp/gists{/gist_id}","starred_url":"https://api.github.com/users/cartermp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cartermp/subscriptions","organizations_url":"https://api.github.com/users/cartermp/orgs","repos_url":"https://api.github.com/users/cartermp/repos","events_url":"https://api.github.com/users/cartermp/events{/privacy}","received_events_url":"https://api.github.com/users/cartermp/received_events","type":"User","site_admin":false},"repo":{"id":44759105,"name":"core-docs","full_name":"cartermp/core-docs","owner":{"login":"cartermp","id":6309070,"avatar_url":"https://avatars.githubusercontent.com/u/6309070?v=3","gravatar_id":"","url":"https://api.github.com/users/cartermp","html_url":"https://github.com/cartermp","followers_url":"https://api.github.com/users/cartermp/followers","following_url":"https://api.github.com/users/cartermp/following{/other_user}","gists_url":"https://api.github.com/users/cartermp/gists{/gist_id}","starred_url":"https://api.github.com/users/cartermp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cartermp/subscriptions","organizations_url":"https://api.github.com/users/cartermp/orgs","repos_url":"https://api.github.com/users/cartermp/repos","events_url":"https://api.github.com/users/cartermp/events{/privacy}","received_events_url":"https://api.github.com/users/cartermp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cartermp/core-docs","description":".NET Core documentation (work in progress).","fork":true,"url":"https://api.github.com/repos/cartermp/core-docs","forks_url":"https://api.github.com/repos/cartermp/core-docs/forks","keys_url":"https://api.github.com/repos/cartermp/core-docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cartermp/core-docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cartermp/core-docs/teams","hooks_url":"https://api.github.com/repos/cartermp/core-docs/hooks","issue_events_url":"https://api.github.com/repos/cartermp/core-docs/issues/events{/number}","events_url":"https://api.github.com/repos/cartermp/core-docs/events","assignees_url":"https://api.github.com/repos/cartermp/core-docs/assignees{/user}","branches_url":"https://api.github.com/repos/cartermp/core-docs/branches{/branch}","tags_url":"https://api.github.com/repos/cartermp/core-docs/tags","blobs_url":"https://api.github.com/repos/cartermp/core-docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cartermp/core-docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cartermp/core-docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/cartermp/core-docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cartermp/core-docs/statuses/{sha}","languages_url":"https://api.github.com/repos/cartermp/core-docs/languages","stargazers_url":"https://api.github.com/repos/cartermp/core-docs/stargazers","contributors_url":"https://api.github.com/repos/cartermp/core-docs/contributors","subscribers_url":"https://api.github.com/repos/cartermp/core-docs/subscribers","subscription_url":"https://api.github.com/repos/cartermp/core-docs/subscription","commits_url":"https://api.github.com/repos/cartermp/core-docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/cartermp/core-docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/cartermp/core-docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/cartermp/core-docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/cartermp/core-docs/contents/{+path}","compare_url":"https://api.github.com/repos/cartermp/core-docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cartermp/core-docs/merges","archive_url":"https://api.github.com/repos/cartermp/core-docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cartermp/core-docs/downloads","issues_url":"https://api.github.com/repos/cartermp/core-docs/issues{/number}","pulls_url":"https://api.github.com/repos/cartermp/core-docs/pulls{/number}","milestones_url":"https://api.github.com/repos/cartermp/core-docs/milestones{/number}","notifications_url":"https://api.github.com/repos/cartermp/core-docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cartermp/core-docs/labels{/name}","releases_url":"https://api.github.com/repos/cartermp/core-docs/releases{/id}","deployments_url":"https://api.github.com/repos/cartermp/core-docs/deployments","created_at":"2015-10-22T16:41:05Z","updated_at":"2016-01-15T17:51:23Z","pushed_at":"2016-02-05T03:33:39Z","git_url":"git://github.com/cartermp/core-docs.git","ssh_url":"git@github.com:cartermp/core-docs.git","clone_url":"https://github.com/cartermp/core-docs.git","svn_url":"https://github.com/cartermp/core-docs","homepage":"http://dotnet.readthedocs.org","size":10088,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dotnet:master","ref":"master","sha":"5dc010138ea7a9fb6d19d5c770d633f8200903e2","user":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"repo":{"id":35890081,"name":"core-docs","full_name":"dotnet/core-docs","owner":{"login":"dotnet","id":9141961,"avatar_url":"https://avatars.githubusercontent.com/u/9141961?v=3","gravatar_id":"","url":"https://api.github.com/users/dotnet","html_url":"https://github.com/dotnet","followers_url":"https://api.github.com/users/dotnet/followers","following_url":"https://api.github.com/users/dotnet/following{/other_user}","gists_url":"https://api.github.com/users/dotnet/gists{/gist_id}","starred_url":"https://api.github.com/users/dotnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotnet/subscriptions","organizations_url":"https://api.github.com/users/dotnet/orgs","repos_url":"https://api.github.com/users/dotnet/repos","events_url":"https://api.github.com/users/dotnet/events{/privacy}","received_events_url":"https://api.github.com/users/dotnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dotnet/core-docs","description":".NET Core documentation (work in progress).","fork":false,"url":"https://api.github.com/repos/dotnet/core-docs","forks_url":"https://api.github.com/repos/dotnet/core-docs/forks","keys_url":"https://api.github.com/repos/dotnet/core-docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dotnet/core-docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dotnet/core-docs/teams","hooks_url":"https://api.github.com/repos/dotnet/core-docs/hooks","issue_events_url":"https://api.github.com/repos/dotnet/core-docs/issues/events{/number}","events_url":"https://api.github.com/repos/dotnet/core-docs/events","assignees_url":"https://api.github.com/repos/dotnet/core-docs/assignees{/user}","branches_url":"https://api.github.com/repos/dotnet/core-docs/branches{/branch}","tags_url":"https://api.github.com/repos/dotnet/core-docs/tags","blobs_url":"https://api.github.com/repos/dotnet/core-docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dotnet/core-docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dotnet/core-docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/dotnet/core-docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dotnet/core-docs/statuses/{sha}","languages_url":"https://api.github.com/repos/dotnet/core-docs/languages","stargazers_url":"https://api.github.com/repos/dotnet/core-docs/stargazers","contributors_url":"https://api.github.com/repos/dotnet/core-docs/contributors","subscribers_url":"https://api.github.com/repos/dotnet/core-docs/subscribers","subscription_url":"https://api.github.com/repos/dotnet/core-docs/subscription","commits_url":"https://api.github.com/repos/dotnet/core-docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/dotnet/core-docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/dotnet/core-docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/dotnet/core-docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/dotnet/core-docs/contents/{+path}","compare_url":"https://api.github.com/repos/dotnet/core-docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dotnet/core-docs/merges","archive_url":"https://api.github.com/repos/dotnet/core-docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dotnet/core-docs/downloads","issues_url":"https://api.github.com/repos/dotnet/core-docs/issues{/number}","pulls_url":"https://api.github.com/repos/dotnet/core-docs/pulls{/number}","milestones_url":"https://api.github.com/repos/dotnet/core-docs/milestones{/number}","notifications_url":"https://api.github.com/repos/dotnet/core-docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dotnet/core-docs/labels{/name}","releases_url":"https://api.github.com/repos/dotnet/core-docs/releases{/id}","deployments_url":"https://api.github.com/repos/dotnet/core-docs/deployments","created_at":"2015-05-19T15:13:32Z","updated_at":"2016-02-05T08:11:25Z","pushed_at":"2016-02-06T00:22:23Z","git_url":"git://github.com/dotnet/core-docs.git","ssh_url":"git@github.com:dotnet/core-docs.git","clone_url":"https://github.com/dotnet/core-docs.git","svn_url":"https://github.com/dotnet/core-docs","homepage":"http://dotnet.github.io/docs/index.html","size":13696,"stargazers_count":48,"watchers_count":48,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":57,"mirror_url":null,"open_issues_count":70,"forks":57,"open_issues":70,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dotnet/core-docs/pulls/190"},"html":{"href":"https://github.com/dotnet/core-docs/pull/190"},"issue":{"href":"https://api.github.com/repos/dotnet/core-docs/issues/190"},"comments":{"href":"https://api.github.com/repos/dotnet/core-docs/issues/190/comments"},"review_comments":{"href":"https://api.github.com/repos/dotnet/core-docs/pulls/190/comments"},"review_comment":{"href":"https://api.github.com/repos/dotnet/core-docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dotnet/core-docs/pulls/190/commits"},"statuses":{"href":"https://api.github.com/repos/dotnet/core-docs/statuses/3d1e5cadd73e55fef230628baf49480c080aa329"}}}}