Skip to content

Instantly share code, notes, and snippets.

@richlander
Last active December 14, 2016 16:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richlander/d0bb6f3c9a796a3e67d2 to your computer and use it in GitHub Desktop.
Save richlander/d0bb6f3c9a796a3e67d2 to your computer and use it in GitHub Desktop.
Getting Started Writing a .NET Core app and Class Library

Getting Started Writing a .NET Core app and Class Library

These instructions are basic and a work in progress. They will be improving a lot over time.

Once you've followed the steps in this document, use the following sample to see the changes you need to make to your project: https://github.com/dotnet/corefxlab/tree/master/samples/ClassLib.

Installing the tools

  1. Install Visual Studio 2015 - https://www.visualstudio.com/downloads/download-visual-studio-vs
  2. Check "Universal Windows App Development Tools" in the initial install or modify the install to include it.

VS Install

  1. Install (latest PRIVATE nuget vsix)[https://www.myget.org/F/nuget-vsix/vsix/NuGet.0d421874-a3b2-4f67-b53a-ecfce878063b-3.3.0.152.vsix]. Not that this NuGet VSIX is from the dev feed, which contains the latest changes necessary to complete the rest of the instructions. It will updated your existing NuGet client.

  2. Setup ".NET Core Dev Feed" package source -> "http://myget.org/F/dotnet-core". Goto Tools | Options.

NuGet Feed

Note: Eventually these packages will be available on nuget.org and so this feed will not be interesting for anyone that doesn't want daily dev builds from the corefx/coreclr repos.

Create a New Class Library

  1. File > New

New Project

  1. Select ".NET Framework 4.6" and "ASP.NET Core 5.0"

Portable

  1. At this point the project should compile

Add support for generations

Currently to enable generations you need do to some manual steps

  1. Manually edit your csproj file by right clicking on the project and select unload and then right click and select edit. Add this to the bottom of your project file:
.NETPlatform,Version=v5.4

Project Group

  1. Save and close your project file and then reload it.

  2. Open project.json file and change "dotnet" to "dotnet5.4".

project.json

  1. Save it.
  2. At this point your project should be in a buildable state and targeting generation 5.4.

Update your packages to the latest

  1. Now if you want to update to the latest version of the meta-packages right click on references and chose "Manage Nuget Packages". a. Click "Updates" tab a. Check the "Include prerelease" check-box a. Select ".NET Core Dev Feed" as the package source. a. Check "Select all packages" a. Click "Update". Accept the preview dialog and the license agreement (might take a while to pop-up).

NuGet Package Manager

  1. Your project should now be in a buildable state again with the latest version of our library packages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment