Files
dotnet-runtime/docs/libraries/project-docs/getting-started-core.md
T
Bill Wert 26593b1f18 Update getting-started-core.md for VS2015U1
With U1 separate downloads of Nuget are no longer required. I also changed the project file changes from a screenshot to an image, so it's easy to copy/paste the blobs of XML. Other minor formatting cleanups.


Commit migrated from https://github.com/dotnet/corefx/commit/6b5e341ddc643270f5e60fc61f17144c6fac7e86
2015-11-30 16:14:12 -08:00

4.3 KiB

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. These instructions are current for Visual Studio 2015 Update 1.

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/NetCoreSample.

Installing the tools

  1. Install Visual Studio 2015 - https://www.visualstudio.com/downloads/download-visual-studio-vs
    Ensure you're running Visual Studio 2015 Update 1 (in Help->About in Visual Studio, you should see version 14.0.24020.00 or higher. If not, update in Tools->Extensions and Updates.)
  2. Check "Universal Windows App Development Tools" in the initial install or modify the install to include it.

VS Install

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 the Platform Standard

Currently to enable leveraging packages that target the Platform Standard 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. Remove this line:
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

And replace it with this:

  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

Add this at the end of the file, before the closing Project tag:

  <PropertyGroup>
    <NuGetTargetMoniker>.NETPlatform,Version=v5.4</NuGetTargetMoniker>
  </PropertyGroup>
  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

To update to the RC1 packages, adjust your project.json as follows:

"dependencies": {
  "Microsoft.NETCore": "5.0.1-beta-23516",
  "Microsoft.NETCore.Portable.Compatibility": "1.0.1-beta-23516"
},

To trigger the update to the latest version of the meta-packages right click on references and chose "Manage Nuget Packages":

  1. Click "Updates" tab
  2. Check the "Include prerelease" check-box
  3. Click the checkboxes for the packages, and click "Update"

NuGet Package Manager

Advanced: Updating and using nuget.exe

Future changes to the CoreCLR/CoreFX packages may require newer versions of Nuget than are currently in Visual Studio. In that case, you will need to follow these directions:

  1. Download the latest nuget.exe commandline client. This is required until a new NuGet Visual Studio extension is available. Browse to https://www.myget.org/gallery/nugetbuild and download the NuGet.Commandline package. Rename the extension from .nupkg to .zip and extract nuget.exe from the tools folder.
  2. Disable NuGet's built-in package restore since that won't be using the latest nuget.exe we just downloaded. Goto Tools | NuGet Package Manager | Package Manager Settings | General. Disable Restore
  3. Setup ".NET Core Dev Feed" package source -> "http://myget.org/F/dotnet-core". Goto Tools | NuGet Package Manager | Package Manager Settings | Package Sources. NuGet Feed
  4. In the Nuget Package Manager, above, follow the same steps, choosing '.NET Core Dev Feed' instead of the normal Nuget.org feed.
  5. Run 'nuget.exe restore project.lock.json'