Skip to content

Commit

Permalink
Add a target for netstandard2.0 (dotnet/core-setup#4586)
Browse files Browse the repository at this point in the history
* Add a target for netstandard2.0

Adding netstandard2.0 TFMs to the PlatformAbstractions and DependencyModel libraries so we don't force users to bring down unnecessary dependencies.

Fix dotnet/core-setup#3680

* Add a comment explaining the Newtonsoft.Json versioning reasoning.


Commit migrated from dotnet/core-setup@2c99636
  • Loading branch information
eerhardt authored Sep 20, 2018
1 parent 04d14d2 commit 59c298c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/installer/managed/CommonManaged.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
<AssemblyFileVersion>$(VersionPrefix)</AssemblyFileVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<IncludeSymbols>true</IncludeSymbols>
<Serviceable>true</Serviceable>
<PackageLicenseUrl>https://github.com/dotnet/core-setup/blob/master/LICENSE.TXT</PackageLicenseUrl>
Expand All @@ -21,6 +20,10 @@
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
</PropertyGroup>

<PropertyGroup>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>git://github.com/dotnet/core-setup</RepositoryUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

<PropertyGroup>
<Description>Abstractions for making code that uses file system and environment testable.</Description>
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'" >netstandard1.3</TargetFrameworks>
<TargetFrameworks>net45;netstandard1.3;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'" >netstandard1.3;netstandard2.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

Expand All @@ -17,9 +17,7 @@
<PackageReference Include="System.Runtime.Extensions" Version="4.1.0" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' != 'netstandard2.0' ">
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.0.0" />
</ItemGroup>


</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,32 @@

<PropertyGroup>
<Description>Abstractions for reading `.deps` files.</Description>
<TargetFrameworks>net451;netstandard1.3;netstandard1.6</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.3;netstandard1.6</TargetFrameworks>
<TargetFrameworks>net451;netstandard1.3;netstandard1.6;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.3;netstandard1.6;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<Choose>
<!--
Newtonsoft.Json v11.0.1 is the first verison that targets netstandard2.0. Since we added a target for netstandard2.0
so users aren't forced to download the 1.x dependencies, it makes sense to use this version of Newtonsoft.Json.
However, we still use the previous (v9.0.1) for other TFMs, so existing users don't need to upgrade their Newtonsoft.Json.
For example, the SDK targets net4x and is loaded in VS, so it can't upgrade to a new Newtonsoft.Json.
-->
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PropertyGroup>
<NewtonsoftJsonPackageVersion>11.0.1</NewtonsoftJsonPackageVersion>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<NewtonsoftJsonPackageVersion>9.0.1</NewtonsoftJsonPackageVersion>
</PropertyGroup>
</Otherwise>
</Choose>

<ItemGroup>
<ProjectReference Include="..\Microsoft.DotNet.PlatformAbstractions\Microsoft.DotNet.PlatformAbstractions.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' Or '$(TargetFramework)' == 'netstandard1.6' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
<PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.0" />
<PackageReference Include="FluentAssertions" Version="4.19.4" />
<PackageReference Include="Moq" Version="4.7.142" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="NuGet.Versioning" Version="4.0.0" />
<PackageReference Include="Microsoft.DotNet.ProjectModel" Version="1.0.0-rc2-002702" />
<ProjectReference Include="..\..\managed\Microsoft.DotNet.PlatformAbstractions\Microsoft.DotNet.PlatformAbstractions.csproj" />
Expand Down

0 comments on commit 59c298c

Please sign in to comment.