

Dotnet build or dotnet run does it for you.
Create new console app visual studio 2017 code#
VS Code likes to tell me to restore the project I.e. Look at the proj file and you can see the package references inserted Now add the packages dotnet add package MongoDB.Driver
Create new console app visual studio 2017 driver#
So lets add the HtmlAgility pack and a C# driver for MongoDB – no reason for them other than I often use them.Ĭhange directories back to common library cd. We commonly want to add some nuget packages to our projects. So the console app can access code in the common project and the two will build out together. Inserts the following into the console proj file dotnet new classlib -o Demo.CommonĬreates an empty project called Demo.Common with a nice simple proj file thus Ĭhange to the console app direct and run the add reference common cd Demo.ConsoleApp dotnet add reference. Next we want to create a C# dll to host some common code like data access. So our proj file for the console app is simply … Net Core is that it’s had all the gubbins stripped out. If we want a different name to the folder we do that by dotnet new console -n MyProjectName -o Demo.ConsoleAppīut we don’t want that. This installs the console app in a new folder with the same name as it’s containing folder. Net Core 2.0 we get the csproj file rather than the json project file of earlier versions. This installs our console application project. Navigate to the root folder and enter your first command Create Console Application dotnet new console -o Demo.ConsoleApp Net Core CLI commands can be entered into the terminal window in VS Code or into the standard command prompt if you prefer. To do this you’ll need VS Code’s C# extension installed into visual studio. Demo.Common/ĭotnet sln add Demo.ConsoleApp/ In case you don’t want to read the detail – the commands used to set up all projects, solutions and references areįrom project root dotnet new console -o Demo.ConsoleAppĭotnet add reference. I enjoy a challenge so using the command line seems fun (to me). Since we using VS Code and enjoying it’s lightweightness we’ll be relying completely on the new. We need a solution that can build out all these projects in one click. It will look like this when we are finished A library with data access code that is common to both.The challenge is to create a solution in VS Code with multiple projects.
