From https://github.com/dotnet/source-build/discussions/3481 --- a/src/nuget-client/build/common.project.props +++ a/src/nuget-client/build/common.project.props @@ -14,7 +14,7 @@ v4.7.2 net472 netcoreapp3.1 - net7.0 + net8.0 net7.0 net7.0;net8.0 netstandard2.0 @@ -24,7 +24,7 @@ $(TargetFrameworksExe);net7.0 $(NETFXTargetFramework);netcoreapp5.0 netcoreapp5.0 - net7.0 + net8.0 $(NETFXTargetFramework);$(NetStandardVersion) $(NETCoreTargetFramework);$(NetStandardVersion) $(TargetFrameworksLibrary);netcoreapp5.0 --- a/src/nuget-client/build/common.targets +++ b/src/nuget-client/build/common.targets @@ -6,7 +6,7 @@ true - + $(DefineConstants);IS_CORECLR true --- a/src/nuget-client/src/NuGet.Core/NuGet.Configuration/NuGet.Configuration.csproj +++ b/src/nuget-client/src/NuGet.Core/NuGet.Configuration/NuGet.Configuration.csproj @@ -26,7 +26,7 @@ - + --- a/src/nuget-client/src/NuGet.Core/NuGet.PackageManagement/NuGet.PackageManagement.csproj +++ b/src/nuget-client/src/NuGet.Core/NuGet.PackageManagement/NuGet.PackageManagement.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/NuGet.Clients/NuGet.PackageManagement.PowerShellCmdlets/Exceptions/PackageSourceException.cs b/src/NuGet.Clients/NuGet.PackageManagement.PowerShellCmdlets/Exceptions/PackageSourceException.cs index ef589f85a..a0615d68c 100644 --- a/src/nuget-client/src/NuGet.Clients/NuGet.PackageManagement.PowerShellCmdlets/Exceptions/PackageSourceException.cs +++ b/src/nuget-client/src/NuGet.Clients/NuGet.PackageManagement.PowerShellCmdlets/Exceptions/PackageSourceException.cs @@ -14,6 +14,9 @@ public PackageSourceException(string message) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected PackageSourceException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Commands/Common/CommandException.cs b/src/NuGet.Core/NuGet.Commands/Common/CommandException.cs index 0b2ded3fc..6cf41ea16 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Commands/Common/CommandException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Commands/Common/CommandException.cs @@ -29,6 +29,9 @@ public CommandException(string message, Exception exception) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected CommandException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/src/NuGet.Core/NuGet.Configuration/Exceptions/NuGetConfigurationException.cs b/src/NuGet.Core/NuGet.Configuration/Exceptions/NuGetConfigurationException.cs index 7e62c4562..88ab349ba 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Configuration/Exceptions/NuGetConfigurationException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Configuration/Exceptions/NuGetConfigurationException.cs @@ -22,6 +22,9 @@ public NuGetConfigurationException(string message, Exception innerException) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected NuGetConfigurationException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Frameworks/FrameworkException.cs b/src/NuGet.Core/NuGet.Frameworks/FrameworkException.cs index 9e538d481..5a7fd3feb 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Frameworks/FrameworkException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Frameworks/FrameworkException.cs @@ -14,6 +14,9 @@ public FrameworkException(string message) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected FrameworkException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Packaging/Licenses/NuGetLicenseExpressionParsingException.cs b/src/NuGet.Core/NuGet.Packaging/Licenses/NuGetLicenseExpressionParsingException.cs index b48fe5bdd..bee4f569b 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Packaging/Licenses/NuGetLicenseExpressionParsingException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Packaging/Licenses/NuGetLicenseExpressionParsingException.cs @@ -18,6 +18,9 @@ public NuGetLicenseExpressionParsingException(string message, Exception innerExc { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected NuGetLicenseExpressionParsingException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Protocol/Exceptions/FatalProtocolException.cs b/src/NuGet.Core/NuGet.Protocol/Exceptions/FatalProtocolException.cs index 68913b98d..999da9db7 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/FatalProtocolException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/FatalProtocolException.cs @@ -18,6 +18,9 @@ public FatalProtocolException(string message, Exception innerException) : base(m { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected FatalProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Protocol/Exceptions/InvalidCacheProtocolException.cs b/src/NuGet.Core/NuGet.Protocol/Exceptions/InvalidCacheProtocolException.cs index de810344a..07ae05cae 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/InvalidCacheProtocolException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/InvalidCacheProtocolException.cs @@ -23,6 +23,9 @@ public InvalidCacheProtocolException(string message, Exception innerException) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected InvalidCacheProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Protocol/Exceptions/NuGetProtocolException.cs b/src/NuGet.Core/NuGet.Protocol/Exceptions/NuGetProtocolException.cs index 8a1a81c9d..0655b8429 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/NuGetProtocolException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/NuGetProtocolException.cs @@ -22,6 +22,9 @@ public NuGetProtocolException(string message, Exception innerException) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected NuGetProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Protocol/Exceptions/RetriableProtocolException.cs b/src/NuGet.Core/NuGet.Protocol/Exceptions/RetriableProtocolException.cs index 4a63a8f4c..a53490f62 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/RetriableProtocolException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Exceptions/RetriableProtocolException.cs @@ -17,6 +17,9 @@ public RetriableProtocolException(string message, Exception innerException) : ba { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected RetriableProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Protocol/Plugins/PluginException.cs b/src/NuGet.Core/NuGet.Protocol/Plugins/PluginException.cs index da7df46fd..ea8c8083e 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Plugins/PluginException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Plugins/PluginException.cs @@ -31,6 +31,9 @@ public PluginException(string message, Exception innerException) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif private PluginException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Protocol/Plugins/ProtocolException.cs b/src/NuGet.Core/NuGet.Protocol/Plugins/ProtocolException.cs index df18f9f81..e701ece77 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Plugins/ProtocolException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Protocol/Plugins/ProtocolException.cs @@ -31,6 +31,9 @@ public ProtocolException(string message, Exception innerException) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif private ProtocolException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverConstraintException.cs b/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverConstraintException.cs index 6998e28c1..e9252092a 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverConstraintException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverConstraintException.cs @@ -17,6 +17,9 @@ public NuGetResolverConstraintException(string message) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected NuGetResolverConstraintException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverException.cs b/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverException.cs index e2b426eb4..c3ea9fb08 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverException.cs @@ -14,6 +14,9 @@ public NuGetResolverException(string message) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected NuGetResolverException(SerializationInfo info, StreamingContext context) : base(info, context) { } diff --git a/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverInputException.cs b/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverInputException.cs index e1542ec4f..0471a3597 100644 --- a/src/nuget-client/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverInputException.cs +++ b/src/nuget-client/src/NuGet.Core/NuGet.Resolver/Exceptions/NuGetResolverInputException.cs @@ -17,6 +17,9 @@ public NuGetResolverInputException(string message) { } +#if NET8_0_OR_GREATER + [Obsolete(DiagnosticId = "SYSLIB0051")] +#endif protected NuGetResolverInputException(SerializationInfo info, StreamingContext context) : base(info, context) { }