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

Update to .Net 8 #146

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
352 changes: 159 additions & 193 deletions NuGetKeyVaultSignTool.Core/KeyVaultSignatureProvider.cs

Large diffs are not rendered by default.

19 changes: 12 additions & 7 deletions NuGetKeyVaultSignTool.Core/NuGetKeyVaultSignTool.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0-rc.2.21480.5" />
<PackageReference Include="NuGet.Packaging" Version="6.0.0-preview.4.243" />
<PackageReference Include="NuGet.Protocol" Version="6.0.0-preview.4.243" />
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.6.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="NuGet.Packaging" Version="6.10.1" />
<PackageReference Include="NuGet.Protocol" Version="6.10.1" />
<PackageReference Include="RSAKeyVaultProvider" Version="2.1.1" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="6.0.0-rc.2.21480.5" />
<PackageReference Include="System.Security.Cryptography.Pkcs" Version="8.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Update="NuGet.Packaging" Version="6.0.0-xprivate.60026" />
<PackageReference Update="NuGet.Protocol" Version="6.0.0-xprivate.60026" />
</ItemGroup>


<ItemGroup>
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageReference Update="Nerdbank.GitVersioning" Version="3.6.139" />
</ItemGroup>

</Project>
139 changes: 63 additions & 76 deletions NuGetKeyVaultSignTool.Core/NuGetLogger.cs
Original file line number Diff line number Diff line change
@@ -1,96 +1,83 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging;
using NuGet.Common;
using System.Threading.Tasks;
using ILogger = Microsoft.Extensions.Logging.ILogger;
using LogLevel = NuGet.Common.LogLevel;

namespace NuGetKeyVaultSignTool
{
class NuGetLogger : NuGet.Common.ILogger
{
readonly ILogger logger;
private readonly string fileName;
namespace NuGetKeyVaultSignTool;

public NuGetLogger(ILogger logger, string fileName)
{
this.logger = logger;
this.fileName = fileName;
}
internal class NuGetLogger(ILogger logger, string fileName) : NuGet.Common.ILogger
{
public void Log(NuGet.Common.LogLevel level, string data)
{
logger.Log(ConvertLevel(level), "NuGet [{fileName}]: {data}", fileName, data);
}

public void Log(NuGet.Common.LogLevel level, string data)
{
logger.Log(ConvertLevel(level), $"NuGet [{fileName}]: {data}");
}
public void Log(ILogMessage message)
{
Log(message.Level, message.FormatWithCode());
}

public void Log(ILogMessage message)
{
Log(message.Level, message.FormatWithCode());
}
public Task LogAsync(NuGet.Common.LogLevel level, string data)
{
Log(level, data);
return Task.CompletedTask;
}

public Task LogAsync(NuGet.Common.LogLevel level, string data)
{
Log(level, data);
return Task.CompletedTask;
}
public Task LogAsync(ILogMessage message)
{
Log(message.Level, message.FormatWithCode());

public Task LogAsync(ILogMessage message)
{
Log(message.Level, message.FormatWithCode());
return Task.CompletedTask;
}

return Task.CompletedTask;
}
public void LogDebug(string data)
{
Log(LogLevel.Debug, data);
}

public void LogDebug(string data)
{
Log(LogLevel.Debug, data);
}
public void LogError(string data)
{
Log(LogLevel.Error, data);
}

public void LogError(string data)
{
Log(LogLevel.Error, data);
}
public void LogInformation(string data)
{
Log(LogLevel.Information, data);
}

public void LogInformation(string data)
{
Log(LogLevel.Information, data);
}
public void LogInformationSummary(string data)
{
Log(LogLevel.Information, data);
}

public void LogInformationSummary(string data)
{
Log(LogLevel.Information, data);
}
public void LogMinimal(string data)
{
Log(LogLevel.Minimal, data);
}

public void LogMinimal(string data)
{
Log(LogLevel.Minimal, data);
}
public void LogVerbose(string data)
{
Log(LogLevel.Verbose, data);
}

public void LogVerbose(string data)
{
Log(LogLevel.Verbose, data);
}
public void LogWarning(string data)
{
Log(LogLevel.Warning, data);
}

public void LogWarning(string data)
private static Microsoft.Extensions.Logging.LogLevel ConvertLevel(LogLevel level)
{
return level switch
{
Log(LogLevel.Warning, data);
}

static Microsoft.Extensions.Logging.LogLevel ConvertLevel(LogLevel level)
{
return level switch
{
LogLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug,
LogLevel.Verbose => Microsoft.Extensions.Logging.LogLevel.Trace,
LogLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information,
LogLevel.Minimal => Microsoft.Extensions.Logging.LogLevel.Information,
LogLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
LogLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error,

_ => Microsoft.Extensions.Logging.LogLevel.Information,
};
}


LogLevel.Debug => Microsoft.Extensions.Logging.LogLevel.Debug,
LogLevel.Verbose => Microsoft.Extensions.Logging.LogLevel.Trace,
LogLevel.Information => Microsoft.Extensions.Logging.LogLevel.Information,
LogLevel.Minimal => Microsoft.Extensions.Logging.LogLevel.Information,
LogLevel.Warning => Microsoft.Extensions.Logging.LogLevel.Warning,
LogLevel.Error => Microsoft.Extensions.Logging.LogLevel.Error,

_ => Microsoft.Extensions.Logging.LogLevel.Information,
};
}
}
Loading
Loading