Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for .NET Core 3 and .NET 5 #537

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<Project>
<PropertyGroup>
<MicroBuild_NuPkgSigningEnabled Condition="'$(SignType)' == 'Test'">false</MicroBuild_NuPkgSigningEnabled>

<!-- The target framework 'net5.0' is out of support and will not receive security updates in the future. -->
<CheckEolTargetFramework Condition="'$(TargetFramework)' == 'net5.0'">false</CheckEolTargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand Down
10 changes: 4 additions & 6 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<MicrosoftBuildPackageVersion>17.5.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion>17.7.2</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net461'">15.9.20</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'netcoreapp3.1'">16.9.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net5.0'">16.11.0</MicrosoftBuildPackageVersion>
<MicrosoftBuildPackageVersion Condition="'$(TargetFramework)' == 'net6.0'">17.3.2</MicrosoftBuildPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion>7.0.0</SystemConfigurationConfigurationManagerPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion Condition="'$(TargetFramework)' != 'net7.0' And '$(TargetFramework)' != 'net8.0'">6.0.0</SystemConfigurationConfigurationManagerPackageVersion>
<SystemConfigurationConfigurationManagerPackageVersion Condition="'$(TargetFramework)' == 'net461'">6.0.0</SystemConfigurationConfigurationManagerPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion>7.0.0</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingPackageVersion Condition="'$(TargetFramework)' != 'net7.0' And '$(TargetFramework)' != 'net8.0'">6.0.0</MicrosoftExtensionsFileSystemGlobbingPackageVersion>
</PropertyGroup>
Expand All @@ -34,8 +32,8 @@
<PackageVersion Include="MSBuild.ProjectCreation" Version="10.0.0" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerPackageVersion)" />
<PackageVersion Include="xunit" Version="2.5.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageVersion Include="xunit" Version="2.5.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="6.0.0" />
Expand Down
5 changes: 0 additions & 5 deletions Directory.Solution.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
<Project>
<PropertyGroup>
<!-- The target framework 'net5.0' is out of support and will not receive security updates in the future. -->
<CheckEolTargetFramework Condition="'$(TargetFramework)' == 'net5.0'">false</CheckEolTargetFramework>
</PropertyGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.Build.Traversal" />
</Project>
2 changes: 1 addition & 1 deletion SlnGen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.rsp = Directory.Build.rsp
Directory.Build.targets = Directory.Build.targets
Directory.Packages.props = Directory.Packages.props
Directory.Solution.targets = Directory.Solution.targets
global.json = global.json
LICENSE.txt = LICENSE.txt
NuGet.config = NuGet.config
Packages.props = Packages.props
README.md = README.md
stylecop.json = stylecop.json
version.json = version.json
Expand Down
22 changes: 4 additions & 18 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ variables:
ArtifactsDirectoryName: 'artifacts'
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
DotNetCore3Version: '3.x'
DotNet5Version: '5.x'
DotNet6Version: '6.x'
DotNet7Version: '7.x'
DotNet8Version: '8.x'
# Not using "--channel 8.0 --quality daily", see https://github.com/microsoft/slngen/issues/456
DotNet8InstallArgs: '-version 8.0.100-alpha.1.23061.8'
MSBuildArgs: '"/Property:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)" "/BinaryLogger:$(Build.SourcesDirectory)\$(ArtifactsDirectoryName)\msbuild.binlog"'
SignType: 'Test'

Expand All @@ -38,16 +34,6 @@ stages:
displayName: 'Set SignType to Real for tagged commits'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))

- task: UseDotNet@2
displayName: 'Install .NET Core $(DotNetCore3Version)'
inputs:
version: '$(DotNetCore3Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet5Version)'
inputs:
version: '$(DotNet5Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet6Version)'
inputs:
Expand All @@ -57,12 +43,12 @@ stages:
displayName: 'Install .NET $(DotNet7Version)'
inputs:
version: '$(DotNet7Version)'
includePreviewVersions: true

- script: |
powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) $(DotNet8InstallArgs) -InstallDir D:\a\_work\_tool\dotnet"
dotnet --info
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'
includePreviewVersions: true

- task: MicroBuildSigningPlugin@1
displayName: 'Install MicroBuild Signing Plugin'
Expand Down
53 changes: 5 additions & 48 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ variables:
ArtifactsDirectoryName: 'artifacts'
BuildConfiguration: 'Debug'
BuildPlatform: 'Any CPU'
DotNetCore3Version: '3.x'
DotNet5Version: '5.x'
DotNet6Version: '6.x'
DotNet7Version: '7.x'
DotNet8Version: '8.x'
# Not using "--channel 8.0 --quality daily", see https://github.com/microsoft/slngen/issues/456
DotNet8InstallArgs: '-version 8.0.100-alpha.1.23061.8'
MSBuildArgs: '"/Property:Platform=$(BuildPlatform);Configuration=$(BuildConfiguration)"'
SignType: 'Test'

Expand Down Expand Up @@ -50,16 +46,6 @@ jobs:
pool:
vmImage: $(vmImage)
steps:
- task: UseDotNet@2
displayName: 'Install .NET Core $(DotNetCore3Version)'
inputs:
version: '$(DotNetCore3Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet5Version)'
inputs:
version: '$(DotNet5Version)'

- task: UseDotNet@2
displayName: 'Install .NET $(DotNet6Version)'
inputs:
Expand All @@ -69,25 +55,12 @@ jobs:
displayName: 'Install .NET $(DotNet7Version)'
inputs:
version: '$(DotNet7Version)'
includePreviewVersions: true

- script: |
powershell -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) $(DotNet8InstallArgs) -InstallDir C:\hostedtoolcache\windows\dotnet"
dotnet --info
displayName: 'Install .NET $(DotNet8Version) (Windows)'
condition: eq(variables.osName, 'Windows')

- script: |
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin $(DotNet8InstallArgs) --install-dir /opt/hostedtoolcache/dotnet
dotnet --info
displayName: 'Install .NET $(DotNet8Version) (Linux)'
condition: eq(variables.osName, 'Linux')

- script: |
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin $(DotNet8InstallArgs) --install-dir /Users/runner/hostedtoolcache/dotnet
dotnet --info
displayName: 'Install .NET $(DotNet8Version) (MacOS)'
condition: eq(variables.osName, 'MacOS')
- task: UseDotNet@2
displayName: 'Install .NET $(DotNet8Version)'
inputs:
version: '$(DotNet8Version)'
includePreviewVersions: true

- task: VSBuild@1
displayName: 'Build (Visual Studio)'
Expand All @@ -110,22 +83,6 @@ jobs:
testRunTitle: '$(osName) .NET Framework v4.7.2'
condition: and(succeededOrFailed(), eq(variables.osName, 'Windows'))

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET Core 3.1)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework netcoreapp3.1 /noautorsp $(MSBuildArgs) "/BinaryLogger:$(ArtifactsDirectoryName)/test-netcoreapp3.1.binlog"'
testRunTitle: '$(osName) .NET Core 3.1'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 5)'
inputs:
command: 'test'
arguments: '--no-restore --no-build --framework net5.0 /noautorsp $(MSBuildArgs) "/BinaryLogger:$(ArtifactsDirectoryName)/test-net5.0.binlog"'
testRunTitle: '$(osName) .NET 5.0'
condition: succeededOrFailed()

- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests (.NET 6)'
inputs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<PackAsTool>true</PackAsTool>
<ToolCommandName>slngen</ToolCommandName>
<RollForward>LatestMajor</RollForward>
Expand Down Expand Up @@ -31,22 +31,6 @@
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net472" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=netcoreapp3.1"
IncludeAssets="None"
OutputItemType="SlnGenBuildOutput"
PrivateAssets="All"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="netcoreapp3.1" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net5.0"
IncludeAssets="None"
OutputItemType="SlnGenBuildOutput"
PrivateAssets="All"
ReferenceOutputAssembly="false"
SkipGetTargetFrameworkProperties="true"
TargetFramework="net5.0" />
<ProjectReference Include="..\Microsoft.VisualStudio.SlnGen\Microsoft.VisualStudio.SlnGen.csproj"
SetTargetFramework="TargetFramework=net6.0"
IncludeAssets="None"
Expand Down
45 changes: 31 additions & 14 deletions src/Microsoft.VisualStudio.SlnGen.Tool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;

namespace Microsoft.VisualStudio.SlnGen
{
Expand All @@ -26,6 +25,26 @@ static Program()
}
}

private enum ExitCode
{
Success = 0,
DevelopmentEnvironmentNotFound = 1,
UnsupportedNETSdk = 2,
UnknownNETSdk = 3,
SlnGenNotFound = 4,
UnhandledException = -1,
}

/// <summary>
/// Gets or sets a <see cref="TextWriter" /> to write errors to.
/// </summary>
internal static TextWriter Error { get; set; } = Console.Error;

/// <summary>
/// Gets or sets a <see cref="TextWriter" /> to write output to.
/// </summary>
internal static TextWriter Out { get; set; } = Console.Out;

/// <summary>
/// Executes the program.
/// </summary>
Expand All @@ -44,11 +63,11 @@ public static int Main(string[] args)
{
foreach (string error in developmentEnvironment.Errors)
{
Utility.WriteError(error);
Utility.WriteError(Error, error);
}

// If the development environment couldn't be determined, then we can't proceed since we have no idea what framework to use or MSBuild/dotnet are not available.
return 1;
return (int)ExitCode.DevelopmentEnvironmentNotFound;
}

bool useDotnet = developmentEnvironment.MSBuildExe == null;
Expand All @@ -61,12 +80,10 @@ public static int Main(string[] args)
switch (developmentEnvironment.DotNetSdkMajorVersion)
{
case "3":
framework = "netcoreapp3.1";
break;

case "5":
framework = "net5.0";
break;
Utility.WriteError(Error, "The currently configured .NET SDK {0} is not supported, SlnGen requires .NET SDK 5 or greater.", developmentEnvironment.DotNetSdkVersion);

return (int)ExitCode.UnsupportedNETSdk;

case "6":
framework = "net6.0";
Expand All @@ -83,9 +100,9 @@ public static int Main(string[] args)
break;

default:
Console.WriteLine($"SlnGen does not currently support the .NET SDK {developmentEnvironment.DotNetSdkVersion} defined by in global.json. Please update to the latest version and if you still get this error message, file an issue at https://github.com/microsoft/slngen/issues/new so it can be added.");
Utility.WriteError(Error, "SlnGen does not currently support the .NET SDK {0} defined by in global.json. Please update to the latest version and if you still get this error message, file an issue at https://github.com/microsoft/slngen/issues/new so it can be added.", developmentEnvironment.DotNetSdkVersion);

return -1;
return (int)ExitCode.UnknownNETSdk;
}
}
else
Expand All @@ -108,9 +125,9 @@ public static int Main(string[] args)

if (!slnGenFileInfo.Exists)
{
Console.WriteLine($"SlnGen not found: {slnGenFileInfo.FullName}");
Utility.WriteError(Error, $"SlnGen not found: {slnGenFileInfo.FullName}");

return -1;
return (int)ExitCode.SlnGenNotFound;
}

Process process = new Process
Expand Down Expand Up @@ -139,9 +156,9 @@ public static int Main(string[] args)
}
catch (Exception e)
{
Console.WriteLine($"Unhandled exception: {e}");
Utility.WriteError(Error, $"Unhandled exception: {e}");

return 1;
return (int)ExitCode.UnhandledException;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetDotNet8 Condition="'$(TargetDotNet8)' == '' And $([MSBuild]::VersionGreaterThanOrEquals('$(NETCoreSdkVersion)', '8.0'))">true</TargetDotNet8>
<TargetFrameworks>net472;netcoreapp3.1;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetDotNet8)' == 'true'">$(TargetFrameworks);net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);SA1600</NoWarn>
Expand Down
6 changes: 1 addition & 5 deletions src/Microsoft.VisualStudio.SlnGen.UnitTests/TestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ namespace Microsoft.VisualStudio.SlnGen.UnitTests
public abstract class TestBase : MSBuildTestBase
{
private const string DotNetSdkVersion =
#if NETCOREAPP3_1
"3.1.0";
#elif NET5_0
"5.0.0";
#elif NET6_0
#if NET6_0
"6.0.0";
#elif NET7_0 || NETFRAMEWORK
"7.0.0";
Expand Down
Loading