MSBuild.Sdk.Extras
1.1.0-preview.2.build.8
Prefix Reserved
See the version list below for details.
dotnet add package MSBuild.Sdk.Extras --version 1.1.0-preview.2.build.8
NuGet\Install-Package MSBuild.Sdk.Extras -Version 1.1.0-preview.2.build.8
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.1.0-preview.2.build.8"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add MSBuild.Sdk.Extras --version 1.1.0-preview.2.build.8
#r "nuget: MSBuild.Sdk.Extras, 1.1.0-preview.2.build.8"
// Install MSBuild.Sdk.Extras as a Cake Addin #addin nuget:?package=MSBuild.Sdk.Extras&version=1.1.0-preview.2.build.8&prerelease // Install MSBuild.Sdk.Extras as a Cake Tool #tool nuget:?package=MSBuild.Sdk.Extras&version=1.1.0-preview.2.build.8&prerelease
MSBuild.Sdk.Extras
This package contains a few extra extensions to the SDK-style projects that are currently not available in the main SDK. That feature is tracked in dotnet/sdk#491
The primary goal is to enable multi-targeting without you having to enter in tons of properties within your
csproj
, vbproj
, fsproj
, thus keeping it nice and clean.
See my blog article for some background on how to get started. Installing
this package, MSBuild.Sdk.Extras
adds the missing properties so that you can use any TFM you want.
In short: Create a new .NET Standard class library in VS 2017. Then you can edit the TargetFramework
to a different TFM (after installing this package), or you can rename TargetFramework
to TargetFrameworks
and specify multiple TFM's with a ;
separator.
After building, you can use the Pack
target to easily create a NuGet package: msbuild /t:Pack ...
Few notes:
- This will only work in VS 2017, Visual Studio for Mac. It's possible it will work in Code, but only as an editor as this requires full
msbuild
to build. - To compile, you'll need the desktop build engine --
msbuild
. Most of the platforms rely on tasks and utilities that are not yet cross platform - 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.
NuGet: MSBuild.Sdk.Extras
MyGet CI feed: https://myget.org/F/msbuildsdkextras/api/v3/index.json
Using the Package
To use this package, add a PackageReference
to your project file like this (specify whatever version of the package or wildcard):
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.1.0" PrivateAssets="All" />
Setting PrivateAssets="All"
means that this build-time dependency won't be added as a dependency to any packages you create by
using the Pack targets (msbuild /t:Pack
or dotnet pack
).
Then, at the end of your project file, either .csproj
, .vbproj
or .fsproj
, add the following Import
just before the closing tag
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
This last step is required until Microsoft/msbuild#1045 is resolved.
Targeting UWP
If you plan to target UWP, then you must include the UWP meta-package in your project as well, something like this:
<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="5.4.0" />
</ItemGroup>
Starting with VS 2017 15.4, you can specify the TargetPlatformMinVersion
with the TFM. The exact value depends on your installed Windows SDK; it may be something like uap10.0.16278
. You can even multi-target to support older versions too, so have a uap10.0
and uap10.0.16278
target with different capabilities.
Targeting Tizen
If you plan to target Tizen, then you should include the following meta-package:
<ItemGroup Condition=" '$(TargetFramework)' == 'tizen30' ">
<PackageReference Include="Tizen.NET" Version="3.0.0" />
</ItemGroup>
Targeting UWP, Windows 8.x, Windows Phone 8.1, etc. using the 1.0 SDK tooling
This workaround is needed when using the SDK 1.x tooling. Recommendation is to use the 2.0+ SDK even if targeting 1.x
If you're targeting a WinRT platform and you use the Pack
target, there's an important workaround needed to ensure
that the .pri
files are included in the package correctly. When you call Pack
, you also must override NuGetBuildTasksPackTargets
on the command-line
to ensure the fixed targets get applied. The value you specify must not be a real file.
You also need to add a PackageReference
to the NuGet.Build.Tasks.Pack
v4.3.0 to your project., something like this:
<PackageReference Include="NuGet.Build.Tasks.Pack" Version="4.3.0" PrivateAssets="All" />
On the command line, you need to invoke something like: msbuild MyProject.csproj /t:Pack /p:NuGetBuildTasksPackTargets="workaround"
NuGet/Home#4136 is tracking this.
Single or multi-targeting
Once this package is configured, you can now use any supported TFM in your TargetFramework
or TargetFrameworks
element. The supported TFM families are:
netstandard
(.NET Standard)net
(.NET Framework)net35-client
/net40-client
(.NET Framework Client profile)netcoreapp
(.NET Core App)wpa
(Windows Phone App 8.1)win
(Windows 8 / 8.1)uap
(UWP)wp
(Windows Phone Silverlight, WP7+)sl
(Silverlight 4+)tizen
(Tizen 3.0+)monoandroid
/Xamarin.Android
xamarinios
/Xamarin.iOS
xamarinmac
/Xamarin.Mac
xamarinwatchos
/Xamarin.WatchOS
xamarintvos
/Xamarin.TVOS
portable-
/portableNN-
(legacy PCL profiles likeportable-net45+win8+wpa81+wp8
)
For legacy PCL profiles, the order of the TFM's in the list does not matter but the profile must be an exact match to one of the known profiles. If it's not, you'll get a compile error saying it's unknown. You can see the full list of known profiles here: Portable Library Profiles by Stephen Cleary.
If you try to use a framework that you don't have tools installed for, you'll get an error as well saying to check the tools. In some cases this might mean installing an older version of VS (like 2015) to ensure that the necessary targets are installed on the machine.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages (7)
Showing the top 5 NuGet packages that depend on MSBuild.Sdk.Extras:
Package | Downloads |
---|---|
Redhotminute.Mvx.Plugin.Style
Mvvmcross plugin to easily cross style fonts and colors |
|
ChakraCore.NET.Hosting
Provide hosting feature |
|
AzureMobileClient.Helpers
Provides a reusable set of abstractions and classes for using the Microsoft Azure Mobile Client |
|
MSBuild.CompilerCache
Provides C# and F# compilation caching by extending the CoreCompile MSBuild target with custom tasks. |
|
PlatformBindings
Operating System Library for the .NET Platform Bindings Framework |
GitHub repositories (11)
Showing the top 5 popular GitHub repositories that depend on MSBuild.Sdk.Extras:
Repository | Stars |
---|---|
dotnet/sdk
Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
|
|
inthehand/32feet
Personal Area Networking for .NET. Open source and professionally supported
|
|
dotnet/dotnet
Home of .NET's Virtual Monolithic Repository which includes all the code needed to build the .NET SDK from source
|
|
xamarin/urho
Code to integrate with the Urho3D engine
|
|
xamarin/SignaturePad
|
Version | Downloads | Last updated |
---|---|---|
3.0.44 | 792,726 | 12/17/2021 |
3.0.38 | 187,428 | 9/10/2021 |
3.0.23 | 472,014 | 1/7/2021 |
3.0.22 | 700,654 | 12/6/2020 |
2.1.2 | 173,528 | 7/24/2020 |
2.0.54 | 893,556 | 9/27/2019 |
2.0.46 | 35,103 | 9/19/2019 |
2.0.43 | 10,864 | 9/7/2019 |
2.0.41 | 57,913 | 8/19/2019 |
2.0.31 | 14,397 | 7/12/2019 |
2.0.29 | 15,271 | 6/13/2019 |
2.0.24 | 37,503 | 4/3/2019 |
2.0.0-preview.21 | 1,879 | 2/18/2019 |
2.0.0-preview.14 | 2,922 | 12/12/2018 |
2.0.0-preview.7 | 1,067 | 11/27/2018 |
1.6.68 | 208,884 | 2/18/2019 |
1.6.65 | 204,472 | 11/27/2018 |
1.6.61 | 45,158 | 11/5/2018 |
1.6.60 | 6,969 | 10/31/2018 |
1.6.55 | 56,579 | 9/7/2018 |
1.6.52 | 7,592 | 9/1/2018 |
1.6.47 | 17,658 | 8/17/2018 |
1.6.46 | 332,243 | 7/29/2018 |
1.6.41 | 13,054 | 7/16/2018 |
1.6.37-preview | 1,281 | 7/10/2018 |
1.6.30-preview | 1,295 | 7/9/2018 |
1.6.20-preview | 2,390 | 6/26/2018 |
1.6.19-preview | 1,201 | 6/26/2018 |
1.5.4 | 117,901 | 5/14/2018 |
1.4.0 | 183,670 | 5/1/2018 |
1.3.1 | 27,559 | 4/7/2018 |
1.3.0 | 12,777 | 3/28/2018 |
1.2.2 | 38,485 | 2/27/2018 |
1.2.1 | 42,124 | 1/23/2018 |
1.2.0 | 11,934 | 1/6/2018 |
1.2.0-build.23 | 1,055 | 12/14/2017 |
1.2.0-build.16 | 894 | 12/13/2017 |
1.2.0-build.3 | 990 | 12/12/2017 |
1.1.0 | 27,271 | 10/18/2017 |
1.1.0-preview.2.build.8 | 1,599 | 9/24/2017 |
1.1.0-beta.69 | 1,397 | 8/30/2017 |
1.0.9 | 11,067 | 8/27/2017 |
1.0.7 | 1,370 | 8/25/2017 |
1.0.6 | 10,964 | 7/21/2017 |
1.0.5 | 7,886 | 7/8/2017 |
1.0.4 | 5,512 | 6/21/2017 |
1.0.3 | 119,549 | 6/15/2017 |
1.0.2 | 2,187 | 4/13/2017 |
1.0.1 | 2,756 | 3/28/2017 |
1.0.0 | 5,478 | 3/7/2017 |
1.0.0-rc4-31 | 1,348 | 3/4/2017 |
1.0.0-rc4-19 | 1,397 | 2/25/2017 |
1.0.0-rc4-17 | 1,337 | 2/18/2017 |
1.0.0-rc4-14 | 2,092 | 2/15/2017 |
See the Readme for how to use/configure these targets.
https://github.com/onovotny/MSBuildSdkExtras/blob/master/README.md