Create .NET Standard 2.0 packages with Visual Studio 2017

Applies to NuGet 4.x+ and MSBuild 15.3+ as provided with Visual Studio 2017 Update 3. For earlier versions of Visual Studio 2017, these instructions apply to .NET Standard 1.4 to 1.6 by changing the <TargetFramework> property. Also see Create .NET Standard Packages with Visual Studio 2015 for working with NuGet 3.x+.

The .NET Standard Library is a formal specification of .NET APIs intended to be available on all .NET runtimes, thus establishing greater uniformity in the .NET ecosystem. The .NET Standard Library defines a uniform set of BCL (Base Class Library) APIs for all .NET platforms to implement, independent of workload. It enables developers to produce PCLs that are usable across all .NET runtimes, and reduces if not eliminates platform-specific conditional compilation directives in shared code.

This guide will walk you through creating a nuget package targeting .NET Standard Library 2.0 with Visual Studio 2017 Update 3 and NuGet 4.0.

  1. Pre-requisites
  2. Create the class library project
  3. Edit metadata in the .csproj file
  4. Package the component
  5. Related topics


This walkthrough requires Visual Studio 2017 Update 3 with the .NET Core cross-platform development workload. You can install the Community edition for free from, or use the Professional and Enterprise editions.

The require workload appears as follows in the Visual Studio installer:

.NET Core cross-platform development workload in the Visual Studio Installer

Create the .NET Standard class library project

  1. In Visual Studio, File > New > Project, expand the Visual C# > .NET Standard node, select Class Library (Net Standard), change the name to AppLogger, and click OK.

    Create new class library project

  2. Change the build configuration to Release.

  3. Right-click the AppLogger project in Solution Explorer, select Properties, select the Build tab, check the box for XML documentation file, and set the filename to just AppLogger.xml. Then save the project.

  4. Add your code to the component, such as the following (which clearly just outputs messages to the console):

    namespace AppLogger
        public class Logger
            public void Log(string text)
  5. Build the project (with the Release configuration) and check that DLL and XML files are produced within the bin\Release\netstandard2.0 folder.

Edit metadata in the .csproj file

With NuGet 4.0 and .NET Core projects, package metadata is contained directly in the .csproj file instead of external files such as a .nuspec. A full description of that metadata is found in NuGet pack and restore as MSBuild targets.

  1. Right-click the project in Solution Explorer, select Edit AppLogger.csproj, and then edit the first property group to include package information such as the following:

        <Description>Awesome application logging utility</Description>
        <PackageReleaseNotes>First release</PackageReleaseNotes>
        <Copyright>Copyright 2017 (c) Contoso Corporation. All rights reserved.</Copyright>
        <PackageTags>logger logging logs</PackageTags>
  2. Save the project, then right-click the solution and select Build Solution to again generate all the files for the package, this time with the correct metadata.

Package the component

NuGet 4.0 supports a pack target using MSBuild version 15.1+ (including MSBuild 15.3 as part of Visual Studio 2017 Update 3) when the project contains the necessary package metadata, as was added in the previous section. To invoke MSBuild in this way, simply specify the pack target on the command line in the same folder as the .csproj file:

msbuild /t:pack /p:Configuration=Release

For additional options with msbuild /t:pack, such as including content files, symbols, and source code, see NuGet pack and restore as MSBuild targets.

In any case, the command above generates AppLogger.YOUR_NAME.1.0.0.nupkg in the bin\Release folder by default, as it builds that configuration. If you omit the /p switch, the default configuration will be Debug.

Opening this file in a tool like the NuGet Package Explorer and expanding all the nodes, you'll see the following contents:

NuGet Package Explorer showing the AppLogger package


A .nupkg file is just a ZIP file with a different extension. You can also examine package contents, then, by changing .nupkg to .zip, but remember to restore the extension before uploading a package to

To make your package available to other developers, follow the instructions on Publish a package.