Skip to content
This repository was archived by the owner on Apr 20, 2023. It is now read-only.

Commit 8d7009c

Browse files
jeffkllivarcocc
authored andcommitted
Move some projects to netstandard2.0 (#8692)
* Move some projects to netstandard2.0 * Use version agnostic $(TargetFrameworkIdentifier) property to make changing versions easier since we only care about .NET Framework vs .NET Standard * Add missing project to solution file * Update TestPackageProjects.targets to use netstandard2.0 on non-Windows
1 parent c4cae05 commit 8d7009c

File tree

13 files changed

+31
-24
lines changed

13 files changed

+31
-24
lines changed

build/test/TestPackageProjects.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
4040
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
4141
<Clean>False</Clean>
42-
<MsbuildArgs>/p:TargetFramework=netstandard1.5</MsbuildArgs>
42+
<MsbuildArgs>/p:TargetFramework=netstandard2.0</MsbuildArgs>
4343
</BaseTestPackageProject>
4444
<BaseTestPackageProject Include="src/Microsoft.DotNet.InternalAbstractions">
4545
<Name>Microsoft.DotNet.InternalAbstractions</Name>

src/Microsoft.DotNet.Cli.Sln.Internal/Microsoft.DotNet.Cli.Sln.Internal.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<Description>SLN file reader/writer</Description>
66
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
7-
<TargetFramework>netstandard1.6</TargetFramework>
7+
<TargetFramework>netstandard2.0</TargetFramework>
88
<DebugType>portable</DebugType>
99
<AssemblyName>Microsoft.DotNet.Cli.Sln.Internal</AssemblyName>
1010
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
@@ -23,7 +23,7 @@
2323
<ItemGroup>
2424
<PackageReference Include="System.Collections.Specialized" Version="4.0.1" />
2525
<PackageReference Include="System.Text.RegularExpressions" Version="4.1.0" />
26-
<PackageReference Include="NETStandard.Library" Version="1.6.0" />
26+
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
2727
<PackageReference Include="XliffTasks" Version="$(XliffTasksPackageVersion)" PrivateAssets="All" />
2828
</ItemGroup>
2929
</Project>

src/Microsoft.DotNet.Cli.Utils/Microsoft.DotNet.Cli.Utils.csproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
<PropertyGroup>
55
<Version>$(SdkVersion)</Version>
6-
<TargetFrameworks>netstandard1.5;net46</TargetFrameworks>
7-
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard1.5</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
7+
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0</TargetFrameworks>
88
<WarningsAsErrors>true</WarningsAsErrors>
99
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
1010
<SignAssembly>true</SignAssembly>
@@ -28,11 +28,12 @@
2828
<PackageReference Include="XliffTasks" Version="$(XliffTasksPackageVersion)" PrivateAssets="All" />
2929
</ItemGroup>
3030

31-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.5' ">
31+
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
32+
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
3233
<PackageReference Include="System.Diagnostics.Process" Version="4.1.0" />
3334
</ItemGroup>
3435

35-
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
36+
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETFramework' ">
3637
<Reference Include="System" />
3738
<Reference Include="System.Xml" />
3839
<Reference Include="Microsoft.CSharp" />

src/Microsoft.DotNet.Configurer/Microsoft.DotNet.Configurer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup>
55
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
6-
<TargetFramework>netstandard1.5</TargetFramework>
6+
<TargetFramework>netstandard2.0</TargetFramework>
77
<WarningsAsErrors>true</WarningsAsErrors>
88
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
99
<SignAssembly>true</SignAssembly>

src/Microsoft.DotNet.InternalAbstractions/Microsoft.DotNet.InternalAbstractions.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PackageReference Include="NETStandard.Library" Version="1.6.0" />
1919
</ItemGroup>
2020

21-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
21+
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETStandard' ">
2222
<PackageReference Include="System.AppContext" Version="4.1.0" />
2323
<PackageReference Include="System.Collections" Version="4.0.11" />
2424
<PackageReference Include="System.IO" Version="4.1.0" />

src/Microsoft.DotNet.MSBuildSdkResolver/Interop.NETStandard.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
// NOTE: Currently, only the NET46 build ships (with Visual Studio/desktop msbuild),
55
// but the netstandard1.5 adaptation here acts a proof-of-concept for cross-platform
66
// portability of the underlying hostfxr API and gives us build and test coverage
7-
// on non-Windows machines.
8-
#if NETSTANDARD1_5
7+
// on non-Windows machines. It also ships with msbuild on Mono.
8+
#if NETSTANDARD2_0
99

1010
using System;
1111
using System.Runtime.InteropServices;
@@ -50,4 +50,4 @@ private static int hostfxr_resolve_sdk(string exe_dir, string working_dir, [Out]
5050
}
5151
}
5252

53-
#endif // NETSTANDARD1_5
53+
#endif // NETSTANDARD2_0

src/Microsoft.DotNet.MSBuildSdkResolver/MSBuildSdkResolver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private string GetDotnetExeDirectory()
176176
var environmentProvider = new EnvironmentProvider(_getEnvironmentVariable);
177177
var dotnetExe = environmentProvider.GetCommandPath("dotnet");
178178

179-
#if NETSTANDARD1_5
179+
#if NETSTANDARD2_0
180180
if (dotnetExe != null && !Interop.RunningOnWindows)
181181
{
182182
// e.g. on Linux the 'dotnet' command from PATH is a symlink so we need to

src/Microsoft.DotNet.MSBuildSdkResolver/Microsoft.DotNet.MSBuildSdkResolver.csproj

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
<PropertyGroup>
55
<Version>$(SdkVersion)</Version>
6-
<TargetFrameworks>netstandard1.5;net46</TargetFrameworks>
7-
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.5</TargetFrameworks>
6+
<TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
7+
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard2.0</TargetFrameworks>
88
<PlatformTarget>AnyCPU</PlatformTarget>
99
<RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers>
1010
<WarningsAsErrors>true</WarningsAsErrors>
@@ -20,11 +20,16 @@
2020
<PackageReference Include="Microsoft.NETCore.DotNetHostResolver" Version="$(MicrosoftNETCoreDotNetHostResolverPackageVersion)" PrivateAssets="All" />
2121
</ItemGroup>
2222

23-
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard1.5'">
24-
<PackageReference Include="NETStandard.Library" Version="1.6.0" />
23+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETStandard'">
24+
<PackageReference Include="NETStandard.Library" Version="2.0.0" />
2525
</ItemGroup>
2626

27-
<Target Name="ResolveHostfxrCopyLocalContent" Condition="'$(TargetFramework)' == 'net46'" DependsOnTargets="ResolvePackageDependenciesForBuild" BeforeTargets="AssignTargetPaths">
27+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
28+
<Reference Include="System" />
29+
<Reference Include="System.Core" />
30+
</ItemGroup>
31+
32+
<Target Name="ResolveHostfxrCopyLocalContent" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" DependsOnTargets="RunResolvePackageDependencies" BeforeTargets="AssignTargetPaths">
2833
<ItemGroup>
2934
<Content Include="@(FileDefinitions->'%(ResolvedPath)')" Condition="'%(FileDefinitions.Path)' == 'runtimes/win-x86/native/hostfxr.dll'">
3035
<Link>x86/hostfxr.dll</Link>

src/Microsoft.DotNet.TestFramework/Microsoft.DotNet.TestFramework.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
<PropertyGroup>
55
<Description>Microsoft.DotNet.TestFramework Class Library</Description>
66
<VersionPrefix>$(CliVersionPrefix)</VersionPrefix>
7-
<TargetFramework>netstandard1.5</TargetFramework>
7+
<TargetFramework>netstandard2.0</TargetFramework>
88
<AssemblyOriginatorKeyFile>../../tools/Key.snk</AssemblyOriginatorKeyFile>
99
<SignAssembly>true</SignAssembly>
1010
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
11+
<NetStandardImplicitPackageVersion>2.0.0</NetStandardImplicitPackageVersion>
1112
</PropertyGroup>
1213

1314
<ItemGroup>

src/dotnet/dotnet.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</ItemGroup>
5151
<ItemGroup>
5252
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
53-
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />
53+
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
5454
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.0.0" />
5555
<PackageReference Include="Microsoft.NETCore.App" Version="$(MicrosoftNETCoreAppPackageVersion)" />
5656
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.3.0" />

0 commit comments

Comments
 (0)