MSBuild.NET.DefaultItems 0.8.0

Requires NuGet 4.0 or higher.

Install-Package MSBuild.NET.DefaultItems -Version 0.8.0
dotnet add package MSBuild.NET.DefaultItems --version 0.8.0
<PackageReference Include="MSBuild.NET.DefaultItems" Version="0.8.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MSBuild.NET.DefaultItems --version 0.8.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MSBuild.NET.DefaultItems, 0.8.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MSBuild.NET.DefaultItems as a Cake Addin
#addin nuget:?package=MSBuild.NET.DefaultItems&version=0.8.0

// Install MSBuild.NET.DefaultItems as a Cake Tool
#tool nuget:?package=MSBuild.NET.DefaultItems&version=0.8.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

MSBuild.NET.DefaultItems

Summary

An MSBuild Extension package for including various platforms' (Android, Apple, Tizen, Web, Windows) default build items etc... in .NET projects.

Package Name: MSBuild.NET.DefaultItems

MSBuild.NET.DefaultItems MSBuild.NET.DefaultItems MSBuild-SDKs

Getting started (VS 15.6+)

Visual Studio 2017 Update 6 (aka v15.6) includes support for SDK's resolved from NuGet. That makes using the custom SDKs much easier.

Using the SDK
  1. Create a new project

    • from dotnet new templates.
    • With your existing SDK-style project.
  2. Add <Import Sdk="MSBuild.NET.DefaultItems" Project="Items.{props|targets}" /> to the top and bottom of the file between the <Project> root elements.

  3. You have to tell MSBuild that the Sdk should resolve from NuGet by

    • Adding a global.json containing the SDK name and version.
    • Appending a version info to the Sdk attribute value.
  4. Then you can enable the default items through a set of properties for each supported project types.

The final project should look like this:

<Project Sdk="Microsoft.NET.Sdk">

    <Import Sdk="MSBuild.NET.DefaultItems" Project="Items.props"/>

    <PropertyGroup>
        <TargetFrameworks>net48;net5.0</TargetFrameworks>
        <EnableDefaultXamlItems>true</EnableDefaultXamlItems>
    </PropertyGroup>

    <Import Sdk="MSBuild.NET.DefaultItems" Project="Items.targets"/>

</Project>

You can put the global.json file next to your solution:

{
    "msbuild-sdks": {
        "MSBuild.NET.DefaultItems": "0.8.0"
    }
}

Then, all of your project files, from that directory forward, uses the version from the global.json file. This would be a preferred solution for all the projects in your solution.

Then again, you might want to override the version for just one project OR if you have only one project in your solution (without adding global.json), you can do so like this:

<Project Sdk="Microsoft.NET.Sdk">

    <Import Sdk="MSBuild.NET.DefaultItems/0.8.0" Project="Items.props"/>

    <PropertyGroup>
        <TargetFrameworks>net48;net5.0</TargetFrameworks>
        <EnableDefaultXamlItems>true</EnableDefaultXamlItems>
    </PropertyGroup>

    <Import Sdk="MSBuild.NET.DefaultItems/0.8.0" Project="Items.targets"/>

</Project>

That's it. You do not need to specify the UWP or Tizen meta-packages as they'll be automatically included. After that, you can use the Restore, Build, Pack targets to restore packages, build the project and create NuGet packages. E.g.: msbuild /t:Pack ...

Important to Note
  • It will only work with Visual Studio IDE (Windows/Mac) as it requires the desktop msbuild and the target Platform SDKs which are not cross-platform.
  • It might work in Visual Studio Code, but you have to configure build tasks in launch.json to use desktop msbuild to build.
  • You must install the tools of the platforms you intend to build. For Xamarin, that means the Xamarin Workload; for UWP install those tools as well.

More information on how SDK's are resolved can be found here.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.8.0 172 8/16/2021
0.7.0 326 2/28/2020

Initial support for .NET v5+ SDKs.