MSBuild.NET.Inbox.Sdk 1.0.0

There is a newer version of this package available.
See the version list below for details.

Requires NuGet 4.0 or higher.

<Sdk Name="MSBuild.NET.Inbox.Sdk" Version="1.0.0" />
For projects that support Sdk, copy this XML node into the project file to reference the package.

MSBuild.NET.Inbox.Sdk

Summary

An MSBuild SDK package that redirects to props and targets that comes inbox with .NET Framework. This SDK package is mostly used for testing and for compiling exclusively with the Full Framework MSBuild.

Package Name: MSBuild.NET.Inbox.Sdk

MSBuild.NET.Inbox.Sdk MSBuild.NET.Inbox.Sdk 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. Open your existing MSBuild v4 legacy project (in your code editor of your choice).

  2. Remove the top Import element that imports Microsoft.Common.props, probably located just below the root <Project> element.

  3. Remove the bottom Import element that imports Microsoft.{Common/CSharp/FSharp/VisualBasic}.targets, probably located just above the root </Project> element.

  4. You can add the SDK import in two ways, either through the Sdk attribute in the Project element which implicitly imports the Sdk.{props/targets} or through explicit top and bottom imports in the project file. Finally, Remove unnecessary attributes like xmlns, DefaultTargets (if it's only Build) and ToolsVersion. Keep any the other attributes if you have specified.

    Here's the diff between your old and new project file following the above rules should look like...

    Using the SDK attribute in project element

    -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    +<Project Sdk="MSBuild.NET.Inbox.Sdk">
    -  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
    
    
    
    -  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
     </Project>
    

    Using explicit top and bottom imports with auto targets resolution

    -<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="Validate" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    +<Project InitialTargets="Validate">
    -  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
    +  <Import Sdk="MSBuild.NET.Inbox.Sdk" Project="Sdk.props"/>
    
    
    
    -  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
    +  <Import Sdk="MSBuild.NET.Inbox.Sdk" Project="Sdk.targets"/>
       <Target Name="Validate">
    
       </Target>
     </Project>
    

    Using explicit top and bottom imports using named targets

    -<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="Validate" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    +<Project InitialTargets="Validate">
    -  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
    +  <Import Sdk="MSBuild.NET.Inbox.Sdk" Project="Microsoft.Common.props"/>
    
    
    
    -  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"/>
    +  <Import Sdk="MSBuild.NET.Inbox.Sdk" Project="Microsoft.CSharp.targets"/>
       <Target Name="Validate">
    
       </Target>
     </Project>
    
  5. Finally, 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.

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

    {
        "msbuild-sdks": {
            "MSBuild.NET.Inbox.Sdk": "1.0.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="MSBuild.NET.Inbox.Sdk/1.0.0">
    
    
    
    </Project>
    

That's it. After that, you can use the Build target to build the projects. E.g.: msbuild -t:Build ...

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
1.1.0 293 1/13/2023
1.0.0 289 11/8/2021

Convert MSBuild v4 legacy projects to MSBuild v15+ Sdk-style projects.