Skip to content

Commit

Permalink
Upgrade netframework to net462
Browse files Browse the repository at this point in the history
  • Loading branch information
zentron committed Dec 12, 2023
1 parent 6067d23 commit acfb100
Show file tree
Hide file tree
Showing 75 changed files with 303 additions and 1,097 deletions.
10 changes: 5 additions & 5 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ public Build()
var nugetVersion = NugetVersion.Value;
DoPublish(RootProjectName,
OperatingSystem.IsWindows() ? Frameworks.Net40 : Frameworks.Net60,
OperatingSystem.IsWindows() ? Frameworks.Net462 : Frameworks.Net60,
nugetVersion);
DoPublish(RootProjectName,
OperatingSystem.IsWindows() ? Frameworks.Net452 : Frameworks.Net60,
OperatingSystem.IsWindows() ? Frameworks.Net462 : Frameworks.Net60,
nugetVersion,
FixedRuntimes.Cloud);
Expand Down Expand Up @@ -342,10 +342,10 @@ void CompressCalamariProject(Project project)
var packageActions = new List<Action>
{
() => DoPackage(RootProjectName,
OperatingSystem.IsWindows() ? Frameworks.Net40 : Frameworks.Net60,
OperatingSystem.IsWindows() ? Frameworks.Net462 : Frameworks.Net60,
nugetVersion),
() => DoPackage(RootProjectName,
OperatingSystem.IsWindows() ? Frameworks.Net452 : Frameworks.Net60,
OperatingSystem.IsWindows() ? Frameworks.Net462 : Frameworks.Net60,
nugetVersion,
FixedRuntimes.Cloud),
};
Expand Down Expand Up @@ -386,7 +386,7 @@ void CompressCalamariProject(Project project)
.Executes(async () =>
{
var nugetVersion = NugetVersion.Value;
var defaultTarget = OperatingSystem.IsWindows() ? Frameworks.Net461 : Frameworks.Net60;
var defaultTarget = OperatingSystem.IsWindows() ? Frameworks.Net462 : Frameworks.Net60;
AbsolutePath binFolder = SourceDirectory / "Calamari.Tests" / "bin" / Configuration / defaultTarget;
Directory.Exists(binFolder);
var actions = new List<Action>
Expand Down
4 changes: 1 addition & 3 deletions build/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ namespace Calamari.Build
{
public static class Frameworks
{
public const string Net40 = "net40";
public const string Net452 = "net452";
public const string Net461 = "net461";
public const string Net462 = "net462";
public const string Net60 = "net6.0";
}
}
2 changes: 1 addition & 1 deletion source/Calamari.Aws/Calamari.Aws.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net452;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.Azure/Calamari.Azure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Copyright>Octopus Deploy Pty Ltd</Copyright>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net452;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net461;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<NoWarn>NU5104</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net461;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<RootNamespace>Calamari.AzureCloudService.Tests</RootNamespace>
<AssemblyName>Calamari.AzureCloudService.Tests</AssemblyName>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net462</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>8</LangVersion>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AssemblyName>Calamari.AzureCloudService</AssemblyName>
<RootNamespace>Calamari.AzureCloudService</RootNamespace>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net462</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net461;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64;linux-arm;linux-arm64</RuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net452;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net461;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ValidateExecutableReferencesMatchSelfContained>false</ValidateExecutableReferencesMatchSelfContained>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net452;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
4 changes: 0 additions & 4 deletions source/Calamari.AzureScripting/CalamariCertificateStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,9 @@ static bool HasPrivateKey(X509Certificate2 certificate2)
{
try
{
#if NET452
return certificate2.HasPrivateKey && certificate2.PrivateKey != null;
#else
return certificate2.HasPrivateKey && (
certificate2.GetRSAPrivateKey() != null ||
certificate2.GetDSAPrivateKey() != null);
#endif
}
catch (Exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<RootNamespace>Calamari.AzureServiceFabric.Tests</RootNamespace>
<AssemblyName>Calamari.AzureServiceFabric.Tests</AssemblyName>
<IsPackable>false</IsPackable>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<RootNamespace>Calamari.AzureWebApp.Tests</RootNamespace>
<AssemblyName>Calamari.AzureWebApp.Tests</AssemblyName>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net462</TargetFramework>
<LangVersion>8.0</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ public async Task Deploy_WebApp_Ensure_Tools_Are_Configured()
az group list";
File.WriteAllText(Path.Combine(tempPath.DirectoryPath, "PreDeploy.ps1"), psScript);

// This should be references from Sashimi.Server.Contracts, since Calamari.AzureWebApp is a net461 project this cannot be included.
// This should be references from Sashimi.Server.Contracts, since Calamari.AzureWebApp is a net462 project this cannot be included.
var AccountType = "Octopus.Account.AccountType";

await CommandTestBuilder.CreateAsync<DeployAzureWebCommand, Program>()
Expand Down
2 changes: 1 addition & 1 deletion source/Calamari.AzureWebApp/Calamari.AzureWebApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<IsPackable>false</IsPackable>
<OutputType>Exe</OutputType>
<TargetFramework>net452</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions source/Calamari.CloudAccounts/Calamari.CloudAccounts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<RootNamespace>Calamari.CloudAccounts</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net452;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.1</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="Microsoft.Net.Http" Version="2.2.29" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
38 changes: 10 additions & 28 deletions source/Calamari.Common/Calamari.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,58 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net452;netstandard2.1;net40</TargetFrameworks>
<TargetFrameworks>net462;netstandard2.1;</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net40' ">
<DefineConstants>$(DefineConstants);USE_ALPHAFS_FOR_LONG_FILE_PATH_SUPPORT;HAS_SSL3</DefineConstants>
<PlatformTarget>anycpu</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net452' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
<DefineConstants>$(DefineConstants);USE_ALPHAFS_FOR_LONG_FILE_PATH_SUPPORT;HAS_SSL3</DefineConstants>
<PlatformTarget>anycpu</PlatformTarget>
<NoWarn>CS8600;CS8601;CS8602;CS8603;CS8604</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<DefineConstants>$(DefineConstants);USE_NUGET_V3_LIBS;WORKAROUND_FOR_EMPTY_STRING_BUG;HAS_NULLABLE_REF_TYPES</DefineConstants>
<DefineConstants>$(DefineConstants);WORKAROUND_FOR_EMPTY_STRING_BUG;HAS_NULLABLE_REF_TYPES</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net452' ">
<NoWarn>CS8600;CS8601;CS8602;CS8603;CS8604</NoWarn>
</PropertyGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<ItemGroup>
<PackageReference Include="Autofac" Version="4.8.0" />
<PackageReference Include="Polly" Version="5.4.0" />
<PackageReference Include="System.Diagnostics.Tracing" Version="4.3.0" />
<PackageReference Include="NuGet.Commands" Version="3.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="4.3.0" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.5.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
<PackageReference Include="System.Threading.AccessControl" Version="4.3.0" />
<PackageReference Include="System.Diagnostics.Tracing" Version="4.3.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net40'">
<PackageReference Include="Autofac" Version="3.5.2" />
<Reference Include="System.Web" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net452'">
<PackageReference Include="Autofac" Version="4.8.0" />
<PackageReference Include="Polly" Version="5.4.0" />
<PackageReference Include="System.Diagnostics.Tracing" Version="4.3.0" />

</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net452' ">
<ItemGroup Condition="'$(TargetFramework)' == 'net462' ">
<Reference Include="System.Security" />
<Reference Include="System.Net" />
<PackageReference Include="NuGet.CommandLine" Version="2.8.6" />
<PackageReference Include="NuGet.Core" Version="2.14.0" />
<PackageReference Include="Microsoft.Net.Http" Version="2.2.29" />
<PackageReference Include="AlphaFS" Version="2.1.3-octopus0006" />
</ItemGroup>
Expand Down
6 changes: 2 additions & 4 deletions source/Calamari.Common/CalamariFlavourProgramAsync.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if !NET40
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
Expand Down Expand Up @@ -181,5 +180,4 @@ Task ResolveAndExecuteCommand(ILifetimeScope container, CommonOptions options)
}
}
}
}
#endif
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#if USE_NUGET_V3_LIBS
using NuGet.Packaging;
#else
using NuGet;
#endif
using System;
using System;
using System.IO;
using Calamari.Common.Plumbing;
using NuGet.Packaging;
using SharpCompress.Archives.Zip;

namespace Calamari.Common.Features.Packages.NuGet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
using SharpCompress.Common;
using SharpCompress.Readers;
using SharpCompress.Readers.Tar;
#if !NET40
using Polly;

#endif

namespace Calamari.Common.Features.Packages
{
public class TarPackageExtractor : IPackageExtractor
Expand Down Expand Up @@ -52,9 +49,6 @@ public int Extract(string packageFile, string directory)

void ExtractEntry(string directory, TarReader reader)
{
#if NET40
reader.WriteEntryToDirectory(directory, new PackageExtractionOptions(log));
#else
var extractAttempts = 10;
Policy.Handle<IOException>()
.WaitAndRetry(
Expand All @@ -68,7 +62,6 @@ void ExtractEntry(string directory, TarReader reader)
{
reader.WriteEntryToDirectory(directory, new PackageExtractionOptions(log));
});
#endif
}

protected virtual Stream GetCompressionStream(Stream stream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@
using SharpCompress.Archives;
using SharpCompress.Archives.Zip;
using SharpCompress.Common;
#if !NET40
using Polly;

#endif

namespace Calamari.Common.Features.Packages
{
public class ZipPackageExtractor : IPackageEntryExtractor
Expand Down Expand Up @@ -40,9 +37,6 @@ public int Extract(string packageFile, string directory)

public void ExtractEntry(string directory, IArchiveEntry entry)
{
#if NET40
entry.WriteToDirectory(directory, new PackageExtractionOptions(log));
#else
var extractAttempts = 10;
Policy.Handle<IOException>()
.WaitAndRetry(
Expand All @@ -56,7 +50,6 @@ public void ExtractEntry(string directory, IArchiveEntry entry)
{
entry.WriteToDirectory(directory, new PackageExtractionOptions(log));
});
#endif
}

protected void ProcessEvent(ref int filesExtracted, IEntry entry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public static LineEnding GetMostCommonLineEnding(this string text)
?? LineEnding.Dos;
}

//TODO: NET462 Upgrade - This method can probably be removed
/// <remarks>
/// This method is required as we are using an old version of Octopus.Versioning
/// and can't update because it's no longer compatible with net framework versions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if USE_NUGET_V3_LIBS
using System;
using System;
using NuGet.Versioning;
using Octopus.Versioning;

Expand All @@ -23,5 +22,4 @@ public static NuGetVersion ToNuGetVersion(this IVersion version)
version.Metadata);
}
}
}
#endif
}

0 comments on commit acfb100

Please sign in to comment.