Skip to content

Commit da64717

Browse files
committed
Revert "(#2997) net4.8 removal"
This reverts commit f416196.
1 parent ac66e61 commit da64717

33 files changed

+237
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
strategy:
130130
matrix:
131131
os: [windows-latest, ubuntu-latest, macos-latest]
132-
targetFramework: [net6.0, netcoreapp3.1]
132+
targetFramework: [net48, net6.0, netcoreapp3.1]
133133
fail-fast: false
134134

135135
steps:

build/artifacts/Tasks/ArtifactsMsBuildFullTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,21 @@ public override void Run(BuildContext context)
4343
var netcoreExe = Paths.Integration.Combine("core").Combine("build").Combine(framework).CombineWithFilePath("app.dll");
4444
context.ValidateOutput("dotnet", netcoreExe.FullPath, context.Version.GitVersion.FullSemVer);
4545
}
46+
47+
context.Information("\nTesting msbuild task with msbuild (for full framework)\n");
48+
49+
var msBuildSettings = new MSBuildSettings
50+
{
51+
Verbosity = Verbosity.Minimal,
52+
Restore = true
53+
};
54+
55+
msBuildSettings.WithProperty("GitVersionMsBuildVersion", version);
56+
msBuildSettings.WithProperty("RestoreSource", nugetSource);
57+
58+
context.MSBuild("./tests/integration/full", msBuildSettings);
59+
60+
var fullExe = Paths.Integration.Combine("full").Combine("build").CombineWithFilePath("app.exe");
61+
context.ValidateOutput(fullExe.FullPath, null, context.Version.GitVersion.FullSemVer);
4662
}
4763
}

build/build/Tasks/Test/UnitTest.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace Build.Tasks;
88

99
[TaskName(nameof(UnitTest))]
1010
[TaskDescription("Run the unit tests")]
11-
[TaskArgument(Arguments.DotnetTarget, Constants.NetVersion60, Constants.CoreFxVersion31)]
11+
[TaskArgument(Arguments.DotnetTarget, Constants.NetVersion60, Constants.CoreFxVersion31, Constants.FullFxVersion48)]
1212
[IsDependentOn(typeof(Build))]
1313
public class UnitTest : FrostingTask<BuildContext>
1414
{
@@ -17,7 +17,7 @@ public class UnitTest : FrostingTask<BuildContext>
1717
public override void Run(BuildContext context)
1818
{
1919
var dotnetTarget = context.Argument(Arguments.DotnetTarget, string.Empty);
20-
var frameworks = new[] { Constants.CoreFxVersion31, Constants.NetVersion60 };
20+
var frameworks = new[] { Constants.CoreFxVersion31, Constants.FullFxVersion48, Constants.NetVersion60 };
2121
if (!string.IsNullOrWhiteSpace(dotnetTarget))
2222
{
2323
if (!frameworks.Contains(dotnetTarget, StringComparer.OrdinalIgnoreCase))
@@ -87,6 +87,11 @@ private static void TestProjectForTarget(BuildContext context, FilePath project,
8787
Exclude = new List<string> { "[GitVersion*.Tests]*", "[GitTools.Testing]*" }
8888
};
8989

90+
if (string.Equals(framework, Constants.FullFxVersion48))
91+
{
92+
settings.Filter = context.IsRunningOnUnix() ? $"TestCategory!={Constants.NoMono}" : $"TestCategory!={Constants.NoNet48}";
93+
}
94+
9095
context.DotNetTest(project.FullPath, settings, coverletSettings);
9196
}
9297
}

build/common/Utilities/Constants.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ public class Constants
1010

1111
public const string NetVersion60 = "net6.0";
1212
public const string CoreFxVersion31 = "netcoreapp3.1";
13+
public const string FullFxVersion48 = "net48";
14+
15+
public const string NoMono = "NoMono";
16+
public const string NoNet48 = "NoNet48";
1317

1418
public static readonly string[] VersionsToBuild = { Version60, Version31 };
1519
public static readonly Architecture[] ArchToBuild = { Architecture.Amd64, Architecture.Arm64 };

src/Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
<None Include="../../build/nuspec/README.md" Pack="true" PackagePath="/"/>
8484
</ItemGroup>
8585

86+
<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
87+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
88+
</ItemGroup>
89+
8690
<!-- Workaround to enable .editorconfig based analyzer configuration until dotnet compilers support .editorconfig based configuration -->
8791
<PropertyGroup>
8892
<SkipDefaultEditorConfigAsAdditionalFile>true</SkipDefaultEditorConfigAsAdditionalFile>

src/GitVersion.App.Tests/ExecCmdLineArgumentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void WorkingDirectoryWithoutCommitsFailsWithInformativeMessage()
7373
public void WorkingDirectoryDoesNotExistFailsWithInformativeMessage()
7474
{
7575
var workingDirectory = PathHelper.Combine(ExecutableHelper.GetCurrentDirectory(), Guid.NewGuid().ToString("N"));
76-
var executable = ExecutableHelper.GetDotNetExecutable();
76+
var executable = ExecutableHelper.GetExecutable();
7777

7878
var output = new StringBuilder();
7979
var args = ExecutableHelper.GetExecutableArgs($" /targetpath {workingDirectory} ");

src/GitVersion.App.Tests/GitVersion.App.Tests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
3+
<TargetFrameworks>net48;netcoreapp3.1;net6.0</TargetFrameworks>
44

55
<IsTestProject>true</IsTestProject>
66
</PropertyGroup>
@@ -21,6 +21,7 @@
2121
<ItemGroup>
2222
<Compile Include="..\GitVersion.Core.Tests\Helpers\DirectoryHelper.cs" Link="Helpers\DirectoryHelper.cs" />
2323
<Compile Include="..\GitVersion.Core.Tests\Helpers\ExecutableHelper.cs" Link="Helpers\ExecutableHelper.cs" />
24+
<Compile Include="..\GitVersion.Core.Tests\Helpers\RuntimeHelper.cs" Link="Helpers\RuntimeHelper.cs" />
2425
<Compile Include="..\GitVersion.Core.Tests\Helpers\TestEffectiveConfiguration.cs" Link="Helpers\TestEffectiveConfiguration.cs" />
2526
<Compile Include="..\GitVersion.Core.Tests\Helpers\TestEnvironment.cs" Link="Helpers\TestEnvironment.cs" />
2627
<Compile Include="..\GitVersion.Core.Tests\Helpers\TestFileSystem.cs" Link="Helpers\TestFileSystem.cs" />

src/GitVersion.App.Tests/Helpers/GitVersionHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private static ExecutionResults ExecuteIn(ArgumentBuilder arguments,
3636
params KeyValuePair<string, string?>[] environments
3737
)
3838
{
39-
var executable = ExecutableHelper.GetDotNetExecutable();
39+
var executable = ExecutableHelper.GetExecutable();
4040
var output = new StringBuilder();
4141

4242
var environmentalVariables = new Dictionary<string, string?>

src/GitVersion.App/GitVersion.App.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1010
</PropertyGroup>
1111

12+
<PropertyGroup Condition=" '$(PackAsTool)' != 'true'">
13+
<TargetFrameworks>net48;$(TargetFrameworks);</TargetFrameworks>
14+
</PropertyGroup>
15+
1216
<!-- workaround for https://github.com/dotnet/runtime/issues/49508 -->
1317
<PropertyGroup Condition=" '$(OsxArm64)' == 'true'">
1418
<TargetFrameworks>net6.0</TargetFrameworks>
@@ -21,6 +25,11 @@
2125
<PackageDescription>Derives SemVer information from a repository following GitFlow or GitHubFlow. This is the .NET Core Global Tool allowing usage of GitVersion from command line.</PackageDescription>
2226
</PropertyGroup>
2327

28+
<ItemGroup Condition="'$(TargetFramework)'=='net48'">
29+
<PackageReference Include="JetBrains.Annotations" Version="$(PackageVersion_JetBrainsAnnotations)" />
30+
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="$(PackageVersion_LibGit2Sharp_NativeBinaries)" />
31+
</ItemGroup>
32+
2433
<ItemGroup>
2534
<PackageReference Include="System.Text.Json" Version="$(PackageVersion_MicrosoftJson)" />
2635
<PackageReference Include="System.Text.Encodings.Web" Version="$(PackageVersion_MicrosoftJson)" />

src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ public void NextVersionCanHavePatch()
228228

229229
[Test]
230230
[MethodImpl(MethodImplOptions.NoInlining)]
231+
[Category(NoMono)]
232+
[Description(NoMonoDescription)]
231233
public void CanWriteOutEffectiveConfiguration()
232234
{
233235
var config = this.configProvider.Provide(this.repoPath);

0 commit comments

Comments
 (0)