Skip to content

Commit

Permalink
Retarget from net462 to net472
Browse files Browse the repository at this point in the history
This allows us to update our libgit2sharp dependency. And while projects that use NB.GV may *target* net462 without a problem, NB.GV requiring that build machines have at least net472 installed seems totally reasonable.
  • Loading branch information
AArnott committed May 11, 2023
1 parent 2c95cc7 commit a95ec45
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/NerdBank.GitVersioning/Nerdbank.GitVersioning.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DebugType>Full</DebugType>
<IsPackable>false</IsPackable>
Expand Down
8 changes: 4 additions & 4 deletions src/Nerdbank.GitVersioning.Tasks/AssemblyVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ the code is regenerated.
------------------------------------------------------------------------------
";

#if NET462
#if NETFRAMEWORK
private static readonly CodeGeneratorOptions CodeGeneratorOptions = new CodeGeneratorOptions
{
BlankLinesBetweenMembers = false,
Expand Down Expand Up @@ -136,7 +136,7 @@ public string BuildCode()
return null;
}

#if NET462
#if NETFRAMEWORK
/// <inheritdoc/>
public override bool Execute()
{
Expand Down Expand Up @@ -186,7 +186,7 @@ public override bool Execute()
}
#endif

#if !NET462
#if !NETFRAMEWORK
/// <inheritdoc/>
public override bool Execute()
{
Expand Down Expand Up @@ -233,7 +233,7 @@ private static byte[] GetPublicKeyFromKeyPair(byte[] keyPair)
}
}

#if NET462
#if NETFRAMEWORK
private static CodeMemberField CreateField<T>(string name, T value)
{
return new CodeMemberField(typeof(T), name)
Expand Down
2 changes: 1 addition & 1 deletion src/Nerdbank.GitVersioning.Tasks/NativeVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private void CreateDefines()
{
if (!int.TryParse(this.AssemblyLanguage, out lcid))
{
#if NET462
#if NETFRAMEWORK
try
{
var cultureInfo = new CultureInfo(this.AssemblyLanguage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>

<NuSpecFile>Nerdbank.GitVersioning.nuspec</NuSpecFile>
Expand Down Expand Up @@ -41,16 +41,13 @@
</ItemDefinitionGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build.Tasks.Core" />
<PackageReference Include="Nerdbank.GitVersioning.LKG" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NerdBank.GitVersioning\Nerdbank.GitVersioning.csproj" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.Build.Tasks.Core" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Microsoft.Build.Tasks.Core" />
<PackageReference Include="System.Runtime.Loader" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Target Name="PackBuildOutputs" DependsOnTargets="SatelliteDllsProjectOutputGroup;DebugSymbolsProjectOutputGroup">
<PropertyGroup>
<BuildSubDir Condition=" '$(TargetFramework)' == 'net6.0' ">MSBuildCore\</BuildSubDir>
<BuildSubDir Condition=" '$(TargetFramework)' == 'net462' ">MSBuildFull\</BuildSubDir>
<BuildSubDir Condition=" '$(TargetFramework)' == 'net472' ">MSBuildFull\</BuildSubDir>
</PropertyGroup>
<Error Text="Unrecognized TargetFramework" Condition=" '$(BuildSubDir)' == '' " />
<ItemGroup>
Expand Down
24 changes: 12 additions & 12 deletions src/Nerdbank.GitVersioning.Tasks/Nerdbank.GitVersioning.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@ IMPORTANT: The 3.x release may produce a different version height than prior maj
<repository type="git" url="https://github.com/dotnet/Nerdbank.GitVersioning.git" commit="$commit$" />
</metadata>
<files>
<file src="$BaseOutputPath$net462\LibGit2Sharp.dll" target="build\MSBuildFull\LibGit2Sharp.dll" />
<file src="$BaseOutputPath$net462\LibGit2Sharp.dll.config" target="build\MSBuildFull\LibGit2Sharp.dll.config" />
<file src="$BaseOutputPath$net462\Microsoft.DotNet.PlatformAbstractions.dll" target="build\MSBuildFull\Microsoft.DotNet.PlatformAbstractions.dll" />
<file src="$BaseOutputPath$net462\Nerdbank.GitVersioning.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.dll" />
<file src="$BaseOutputPath$net462\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$net462\Newtonsoft.Json.dll" target="build\MSBuildFull\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$net462\System.Buffers.dll" target="build\MSBuildFull\System.Buffers.dll" />
<file src="$BaseOutputPath$net462\System.Memory.dll" target="build\MSBuildFull\System.Memory.dll" />
<file src="$BaseOutputPath$net462\System.Numerics.Vectors.dll" target="build\MSBuildFull\System.Numerics.Vectors.dll" />
<file src="$BaseOutputPath$net462\System.Runtime.CompilerServices.Unsafe.dll" target="build\MSBuildFull\System.Runtime.CompilerServices.Unsafe.dll" />
<file src="$BaseOutputPath$net462\System.Text.Json.dll" target="build\MSBuildFull\System.Text.Json.dll" />
<file src="$BaseOutputPath$net462\Validation.dll" target="build\MSBuildFull\Validation.dll" />
<file src="$BaseOutputPath$net472\LibGit2Sharp.dll" target="build\MSBuildFull\LibGit2Sharp.dll" />
<file src="$BaseOutputPath$net472\LibGit2Sharp.dll.config" target="build\MSBuildFull\LibGit2Sharp.dll.config" />
<file src="$BaseOutputPath$net472\Microsoft.DotNet.PlatformAbstractions.dll" target="build\MSBuildFull\Microsoft.DotNet.PlatformAbstractions.dll" />
<file src="$BaseOutputPath$net472\Nerdbank.GitVersioning.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.dll" />
<file src="$BaseOutputPath$net472\Nerdbank.GitVersioning.Tasks.dll" target="build\MSBuildFull\Nerdbank.GitVersioning.Tasks.dll" />
<file src="$BaseOutputPath$net472\Newtonsoft.Json.dll" target="build\MSBuildFull\Newtonsoft.Json.dll" />
<file src="$BaseOutputPath$net472\System.Buffers.dll" target="build\MSBuildFull\System.Buffers.dll" />
<file src="$BaseOutputPath$net472\System.Memory.dll" target="build\MSBuildFull\System.Memory.dll" />
<file src="$BaseOutputPath$net472\System.Numerics.Vectors.dll" target="build\MSBuildFull\System.Numerics.Vectors.dll" />
<file src="$BaseOutputPath$net472\System.Runtime.CompilerServices.Unsafe.dll" target="build\MSBuildFull\System.Runtime.CompilerServices.Unsafe.dll" />
<file src="$BaseOutputPath$net472\System.Text.Json.dll" target="build\MSBuildFull\System.Text.Json.dll" />
<file src="$BaseOutputPath$net472\Validation.dll" target="build\MSBuildFull\Validation.dll" />
<file src="$LibGit2SharpNativeBinaries$runtimes\**" target="build\runtimes\" />

<!-- Additional copies to work around DllNotFoundException on Mono (https://github.com/dotnet/Nerdbank.GitVersioning/issues/222) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Nerdbank.GitVersioning.Benchmarks
{
[SimpleJob(RuntimeMoniker.Net70)]
[SimpleJob(RuntimeMoniker.Net462, baseline: true)]
[SimpleJob(RuntimeMoniker.Net472, baseline: true)]
public class GetVersionBenchmarks
{
// You must manually clone these repositories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net7.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net462</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' == 'Windows_NT'">$(TargetFrameworks);net472</TargetFrameworks>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down

0 comments on commit a95ec45

Please sign in to comment.