diff --git a/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.cs b/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.cs index 78bf26847dbe2..9c043b6a585d4 100644 --- a/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.cs +++ b/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.cs @@ -20,6 +20,7 @@ public sealed partial class PreserializedResourceWriter : System.IDisposable, Sy public PreserializedResourceWriter(System.IO.Stream stream) { } public PreserializedResourceWriter(string fileName) { } public void AddActivatorResource(string name, System.IO.Stream value, string typeName, bool closeAfterWrite = false) { } + [System.ObsoleteAttribute("BinaryFormatter serialization is obsolete and should not be used. See https://aka.ms/binaryformatter for more information.", DiagnosticId = "SYSLIB0011", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] public void AddBinaryFormattedResource(string name, byte[] value, string? typeName = null) { } public void AddResource(string name, byte[]? value) { } public void AddResource(string name, System.IO.Stream? value, bool closeAfterWrite = false) { } diff --git a/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.csproj b/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.csproj index daef980d13281..099818780c1d8 100644 --- a/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.csproj +++ b/src/libraries/System.Resources.Extensions/ref/System.Resources.Extensions.csproj @@ -1,6 +1,7 @@ $(NetCoreAppCurrent);$(NetCoreAppPrevious);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum) + true diff --git a/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj b/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj index 508462eb6379f..02d2e48dd5b55 100644 --- a/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj +++ b/src/libraries/System.Resources.Extensions/src/System.Resources.Extensions.csproj @@ -4,6 +4,7 @@ true $(DefineConstants);RESOURCES_EXTENSIONS false + true true $(BaseIntermediateOutputPath)SuggestedBindingRedirects.targets $(BeforePack);GeneratePackageTargetsFile @@ -15,6 +16,8 @@ System.Resources.Extensions.PreserializedResourceWriter + Resource name /// Value of the resource in byte[] form understood by BinaryFormatter /// Assembly qualified type name of the resource + [Obsolete(Obsoletions.BinaryFormatterMessage, DiagnosticId = Obsoletions.BinaryFormatterDiagId, UrlFormat = Obsoletions.SharedUrlFormat)] public void AddBinaryFormattedResource(string name, byte[] value, string? typeName = null) { if (name is null)