Add warning for using BinaryFormatter in GenerateResource on .NET 8 (#8524)

It will be removed in .NET 9; doing so should be discouraged.

Note that this does nothing by default, but we can change that in the SDK.

Fixes #8453

Context
BinaryFormatter is deprecated and will be removed in .NET 9. In addition to the possibility of using a modern MSBuild with an older framework, there are apparently ways you can exempt your project, so we are not currently removing it entirely, and this warning (which is off by default) can be disabled even if it is enabled in the SDK.

Changes Made
I deleted using System.Runtime.Serialization.Formatters.Binary; in GenerateResource, then put a warning before the one usage of BinaryFormatter. That isn't necessarily the best way to figure out where it's used, as it would be helpful to know early, so feel free to comment to that effect.

Then I disabled it via a property and will make a separate PR to enable it in the 8.0 SDK.

Testing
Notes
This commit is contained in:
Forgind 2023-03-28 18:30:00 -07:00 коммит произвёл GitHub
Родитель 8ead272365
Коммит dd5d9f746f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
21 изменённых файлов: 205 добавлений и 38 удалений

Просмотреть файл

@ -1940,6 +1940,48 @@ namespace Microsoft.Build.UnitTests.GenerateResource_Tests.InProc
}
}
[Fact]
public void GenerateResourceWarnsWhenUsingBinaryFormatter()
{
using TestEnvironment env = TestEnvironment.Create();
TransientTestFile resource = env.CreateFile(".resx", @"<?xml version=""1.0"" encoding=""utf-8""?>
<root>
<data name=""$this.Icon"" type=""System.Drawing.Icon, System.Drawing"" mimetype=""application/x-microsoft.net.object.binary.base64"">
<value>
AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA
AAD///8BoqKiDaKiotmioqL5oqKiK////wH///8B////Af///wH///8B////AaKioiGioqLxoqKi5aKi
ohn///8B////AbS0tBW0tLTz29vb/7Ozsu18Wi+Be1gswXtYLO17WCzte1gswXtYLIGzs7Lz2dnZ/7S0
tPu0tLQj////Af///wH///8BxsbGQdPT0//Cv739nGs7/6ZsNf+ubzf/rm83/6ZsNf+hdkr/xcTD/8bG
xf/GxsY/////Af///wH///8B////AYxlNmejiGn1r3hE/7uMXv/Ck3H/xJF0/8OPcf+/kGz/uIpd/7SG
Wf+hhWT1jGU2Z////wH///8B////AZZtOzWWbTvVs31G/8KZcf/Yqon/79/P//r28//69fP/79/R/9en
hf++lGz/s31G/5ZtO9WWbTs1////Af///wGhdUGBsIBK/8abb//Zqoj///7r///67v///fL///7y///8
7////ev/2aN6/8KZbP+wgEr/oXVBgf///wH///8BrH5Iwb+PWP/No4H/8NvB///35v/68uP/xcC2//Ht
3v///Oj///Xf/+/Ur//ImXL/v49Y/6x+SMH///8B////AbeHTu3JnGb/z5+A//rz4v/99un/8vDj/42M
hP+Bf3f/0s/C///76//67Mz/x5Bt/8mcZv+3h07t////Af///wHCkFTtzqZx/9Glif/69un//fju////
+f+BgHn/sa6k/4F/d//Jxrr/+vDT/8mWcv/OpnH/wpBU7f///wH///8BzZlbwdOsdf/Zt5j/8ePW//77
9f/19fP/n56V//Dw6f/4+PL/vrmt//Dawv/Sqof/06x1/82ZW8H///8B////AbOddIvTrXf/38Sa/969
qv//////8PDu/+fl2v////f////3///+8//ctJj/28CW/8Kqfv/Gn2qF////AQCZ3T0KmtjZLpzF9d6/
iv/iyaf/37+u//Hj3P/z8ez/9PHr//Hi2f/cuqP/38Oe/4yxqf84ptH5DprWzwCZ3ScAoON9fNHy7WHD
6O86pMb74seS/+bRqf/gwqb/1a6W/9Wrkv/evaD/5M+m/7/Bnv9Hstf9q+P2/Smw6NkAoOMnAKfpe13J
8eW16Pn/Ycfr7zqqzPPsxIj/6cuU/+fQnf/n0J3/6cuU/97Cjv8yqtD1gdPw9XPQ8+sAp+nNAKfpBQCu
7wUAru+LW8v05b/s+v9cy/HpTbLJxfq8dMH6vHTt+rx07fq8dMFRssjDac/y7XzW9u0Aru/JAK7vHf//
/wH///8BALX0AwC19IEAtfTRALX0ywC19Af///8B////Af///wH///8BALX0FwC19NEAtfTJALX0J///
/wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA
//8AAP//AAD//w==
</value>
</data>
</root>
");
GenerateResource gr = Utilities.CreateTask(_output, usePreserialized: true, env: env);
gr.Sources = new ITaskItem[] { new TaskItem(resource.Path) };
gr.WarnOnBinaryFormatterUse = true;
gr.Execute().ShouldBeTrue();
Utilities.AssertLogContainsResource(gr, "GenerateResource.BinaryFormatterUse", "$this.Icon", "System.Drawing.Icon, System.Drawing");
}
/// <summary>
/// Cause failures in ResourceReader
/// </summary>

Просмотреть файл

@ -32,7 +32,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
@"<data name=""StringResource"" xml:space=""preserve"">
<value>StringValue</value>
<comment>Comment</comment>
</data>"));
</data>"), null, false);
AssertSingleStringResource(resxWithSingleString, "StringResource", "StringValue");
}
@ -45,7 +45,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
@"<data name=""StringResource"">
<value> StringValue </value>
<comment>Comment</comment>
</data>"));
</data>"), null, false);
AssertSingleStringResource(resxWithSingleString, "StringResource", " StringValue ");
}
@ -58,7 +58,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
@"<data name=""StringResource"" xml:space=""preserve"">
<value> </value>
<comment>Comment</comment>
</data>"));
</data>"), null, false);
AssertSingleStringResource(resxWithSingleString, "StringResource", " ");
}
@ -71,7 +71,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
@"<data name=""StringResource"">
<value> </value>
<comment>Comment</comment>
</data>"));
</data>"), null, false);
AssertSingleStringResource(resxWithSingleString, "StringResource", "");
}
@ -83,7 +83,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
ResXHelper.SurroundWithBoilerplate(
@"<data name=""StringResource"" type=""System.String"">
<value>StringValue</value>
</data>"));
</data>"), null, false);
AssertSingleStringResource(resxWithSingleString, "StringResource", "StringValue");
}
@ -100,7 +100,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
</data>
<data name=""2StringResource2"" xml:space=""preserve"">
<value>2StringValue2</value>
</data>"));
</data>"), null, false);
resxWithTwoStrings.Count.ShouldBe(2);
@ -121,7 +121,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"" />
<data name=""$this.AccessibleDescription"" type=""System.Resources.ResXNullRef, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"">
<value />
</data>"));
</data>"), null, false);
resxWithNullRef.ShouldHaveSingleItem();
@ -143,7 +143,7 @@ namespace Microsoft.Build.Tasks.UnitTests.GenerateResource
$@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"" />
<data name=""TextFile1"" type=""System.Resources.ResXFileRef, System.Windows.Forms"">
<value>ResourceHandling\TextFile1.txt;{stringType};utf-8</value>
</data>"));
</data>"), null, false);
AssertSingleStringResource(resxWithLinkedString, "TextFile1", "Contents of TextFile1");
}
@ -174,6 +174,8 @@ $@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Versi
<data name=""TextFile1"" type=""System.Resources.ResXFileRef, System.Windows.Forms"">
<value>ResourceHandling\TextFileInShiftJIS.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;shift_jis</value>
</data>"),
null,
false,
Path.Combine(baseDir.Path, nameof(LoadsStringFromFileRefAsStringWithShiftJISEncoding) + ".resx"),
useRelativePath: true);
@ -210,7 +212,7 @@ $@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Versi
b7eblRw4yy8Ta2GCpaZp1sIzz2LfCMS+EYh9401iw/gG1gYfvzjQIXcAAAAASUVORK5CYII=
</value>
</data>
"));
"), null, false);
resxWithEmbeddedBitmap.ShouldHaveSingleItem();
resxWithEmbeddedBitmap[0].ShouldBeOfType(typeof(TypeConverterByteArrayResource));
@ -228,7 +230,7 @@ $@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Versi
<data name=""color"" type=""System.Drawing.Color, System.Drawing"">
<value>Blue</value>
</data>
"));
"), null, false);
resxWithEmbeddedBitmap.ShouldHaveSingleItem();
resxWithEmbeddedBitmap[0].ShouldBeOfType(typeof(TypeConverterStringResource));
@ -252,7 +254,7 @@ $@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Versi
ResXHelper.SurroundWithBoilerplate(
@" <assembly alias=""System.Drawing"" name=""System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
<data name=""Color1"" type=""System.Drawing.Color, System.Drawing"">Blue</data>
"));
"), null, false);
resxWithEmbeddedBitmap.ShouldHaveSingleItem();
resxWithEmbeddedBitmap[0].ShouldBeOfType(typeof(TypeConverterStringResource));
@ -272,7 +274,7 @@ $@" <assembly alias=""System.Windows.Forms"" name=""System.Windows.Forms, Versi
$@" <data name='Image1' type='System.Resources.ResXFileRef, System.Windows.Forms'>
<value>{bitmapPath};System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
"));
"), null, false);
resxWithLinkedBitmap.ShouldHaveSingleItem();
resxWithLinkedBitmap[0].ShouldBeOfType(typeof(FileStreamResource));
@ -301,7 +303,7 @@ $@" <data name='Image1' type='System.Resources.ResXFileRef, System.Windows.Form
$@" <data name='Image1' type='System.Resources.ResXFileRef, System.Windows.Forms'>
<value>{linkedTextFile.Path};{typeNameInResx}</value>
</data>
"));
"), null, false);
var resource = resources.ShouldHaveSingleItem()
.ShouldBeOfType<LiveObjectResource>();
@ -321,7 +323,7 @@ $@" <data name='Image1' type='System.Resources.ResXFileRef, System.Windows.Form
ResXHelper.SurroundWithBoilerplate(
@" <assembly name=""System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"" />
<data name=""Color1"" type=""System.Drawing.Color, System.Drawing""><value>Blue</value></data>
"));
"), null, false);
resxWithEmbeddedBitmap.ShouldHaveSingleItem();
resxWithEmbeddedBitmap[0].ShouldBeOfType(typeof(TypeConverterStringResource));

Просмотреть файл

@ -40,7 +40,7 @@ namespace Microsoft.Build.UnitTests
cache.IsDirty.ShouldBeFalse();
// Getting a file that wasn't in the cache is a write operation.
cache.GetResXFileInfo(resx, useMSBuildResXReader);
cache.GetResXFileInfo(resx, useMSBuildResXReader, null, false);
cache.IsDirty.ShouldBeTrue();
// Add linkedFiles to further test serialization and deserialization.
@ -72,7 +72,7 @@ namespace Microsoft.Build.UnitTests
resX2.linkedFiles[1].ShouldBe(resX.linkedFiles[1]);
// Asking for a file that's in the cache should not dirty the cache.
cache2.GetResXFileInfo(resx, useMSBuildResXReader);
cache2.GetResXFileInfo(resx, useMSBuildResXReader, null, false);
cache2.IsDirty.ShouldBeFalse();
// Changing UseSourcePath to false should dirty the cache.

Просмотреть файл

@ -274,6 +274,12 @@ namespace Microsoft.Build.Tasks
}
}
// Indicates whether any BinaryFormatter use should lead to a warning.
public bool WarnOnBinaryFormatterUse
{
get; set;
}
/// <summary>
/// Specifies the namespace to use for the generated class source for the
/// strongly typed resource. If left blank, no namespace is used.
@ -808,7 +814,8 @@ namespace Microsoft.Build.Tasks
StronglyTypedClassName,
PublicClass,
ExtractResWFiles,
OutputDirectory);
OutputDirectory,
WarnOnBinaryFormatterUse);
this.StronglyTypedClassName = process.StronglyTypedClassName; // in case a default was chosen
this.StronglyTypedFileName = process.StronglyTypedFilename; // in case a default was chosen
@ -1510,7 +1517,7 @@ namespace Microsoft.Build.Tasks
ResGenDependencies.ResXFile resxFileInfo;
try
{
resxFileInfo = _cache.GetResXFileInfo(sourceFilePath, UsePreserializedResources);
resxFileInfo = _cache.GetResXFileInfo(sourceFilePath, UsePreserializedResources, Log, WarnOnBinaryFormatterUse);
}
catch (Exception e) when (!ExceptionHandling.NotExpectedIoOrXmlException(e) || e is MSBuildResXException)
{
@ -1971,7 +1978,7 @@ namespace Microsoft.Build.Tasks
{
byte[] serializedData = ByteArrayFromBase64WrappedString(data);
BinaryFormatter binaryFormatter = new BinaryFormatter();
BinaryFormatter binaryFormatter = new();
using (MemoryStream memoryStream = new MemoryStream(serializedData))
{
@ -2337,6 +2344,8 @@ namespace Microsoft.Build.Tasks
/// </summary>
private bool _useSourcePath = false;
private bool _logWarningForBinaryFormatter = false;
#endregion
/// <summary>
@ -2357,7 +2366,8 @@ namespace Microsoft.Build.Tasks
string classname,
bool publicClass,
bool extractingResWFiles,
string resWOutputDirectory)
string resWOutputDirectory,
bool logWarningForBinaryFormatter)
{
_logger = log;
_assemblyFiles = assemblyFilesList;
@ -2376,6 +2386,7 @@ namespace Microsoft.Build.Tasks
_resWOutputDirectory = resWOutputDirectory;
_portableLibraryCacheInfo = new List<ResGenDependencies.PortableLibraryFile>();
_usePreserializedResources = usePreserializedResources;
_logWarningForBinaryFormatter = logWarningForBinaryFormatter;
#if !FEATURE_ASSEMBLYLOADCONTEXT
// If references were passed in, we will have to give the ResxResourceReader an object
@ -2980,7 +2991,7 @@ namespace Microsoft.Build.Tasks
}
else
{
foreach (IResource resource in MSBuildResXReader.GetResourcesFromFile(filename, shouldUseSourcePath))
foreach (IResource resource in MSBuildResXReader.GetResourcesFromFile(filename, shouldUseSourcePath, _logger, _logWarningForBinaryFormatter))
{
AddResource(reader, resource, filename, 0, 0);
}

Просмотреть файл

@ -3328,8 +3328,10 @@ Copyright (C) Microsoft Corporation. All rights reserved.
SdkToolsPath="$(ResgenToolPath)"
ExecuteAsTool="$(ResGenExecuteAsTool)"
EnvironmentVariables="$(ResGenEnvironment)"
WarnOnBinaryFormatterUse="$(GenerateResourceWarnOnBinaryFormatterUse)"
MSBuildRuntime="$(GenerateResourceMSBuildRuntime)"
MSBuildArchitecture="$(GenerateResourceMSBuildArchitecture)">
MSBuildArchitecture="$(GenerateResourceMSBuildArchitecture)"
>
<Output TaskParameter="FilesWritten" ItemName="FileWrites"/>
<Output TaskParameter="StronglyTypedFileName" ItemName="Compile"/>

Просмотреть файл

@ -125,13 +125,13 @@ namespace Microsoft.Build.Tasks
translator.Translate(ref baseLinkedFileDirectory);
}
internal ResXFile GetResXFileInfo(string resxFile, bool useMSBuildResXReader)
internal ResXFile GetResXFileInfo(string resxFile, bool useMSBuildResXReader, TaskLoggingHelper log, bool logWarningForBinaryFormatter)
{
// First, try to retrieve the resx information from our hashtable.
if (!resXFiles.TryGetValue(resxFile, out ResXFile retVal))
{
// Ok, the file wasn't there. Add it to our cache and return it to the caller.
retVal = AddResxFile(resxFile, useMSBuildResXReader);
retVal = AddResxFile(resxFile, useMSBuildResXReader, log, logWarningForBinaryFormatter);
}
else
{
@ -141,19 +141,19 @@ namespace Microsoft.Build.Tasks
{
resXFiles.Remove(resxFile);
_isDirty = true;
retVal = AddResxFile(resxFile, useMSBuildResXReader);
retVal = AddResxFile(resxFile, useMSBuildResXReader, log, logWarningForBinaryFormatter);
}
}
return retVal;
}
private ResXFile AddResxFile(string file, bool useMSBuildResXReader)
private ResXFile AddResxFile(string file, bool useMSBuildResXReader, TaskLoggingHelper log, bool logWarningForBinaryFormatter)
{
// This method adds a .resx file "file" to our .resx cache. The method causes the file
// to be cracked for contained files.
var resxFile = new ResXFile(file, BaseLinkedFileDirectory, useMSBuildResXReader);
var resxFile = new ResXFile(file, BaseLinkedFileDirectory, useMSBuildResXReader, log, logWarningForBinaryFormatter);
resXFiles.Add(file, resxFile);
_isDirty = true;
return resxFile;
@ -230,7 +230,7 @@ namespace Microsoft.Build.Tasks
internal string[] LinkedFiles => linkedFiles;
internal ResXFile(string filename, string baseLinkedFileDirectory, bool useMSBuildResXReader) : base(filename)
internal ResXFile(string filename, string baseLinkedFileDirectory, bool useMSBuildResXReader, TaskLoggingHelper log, bool logWarningForBinaryFormatter) : base(filename)
{
// Creates a new ResXFile object and populates the class member variables
// by computing a list of linked files within the .resx that was passed in.
@ -239,7 +239,7 @@ namespace Microsoft.Build.Tasks
if (FileSystems.Default.FileExists(FileName))
{
linkedFiles = GetLinkedFiles(filename, baseLinkedFileDirectory, useMSBuildResXReader);
linkedFiles = GetLinkedFiles(filename, baseLinkedFileDirectory, useMSBuildResXReader, log, logWarningForBinaryFormatter);
}
}
@ -260,7 +260,7 @@ namespace Microsoft.Build.Tasks
/// </summary>
/// <exception cref="ArgumentException">May be thrown if Resx is invalid. May contain XmlException.</exception>
/// <exception cref="XmlException">May be thrown if Resx is invalid</exception>
private static string[] GetLinkedFiles(string filename, string baseLinkedFileDirectory, bool useMSBuildResXReader)
private static string[] GetLinkedFiles(string filename, string baseLinkedFileDirectory, bool useMSBuildResXReader, TaskLoggingHelper log, bool logWarningForBinaryFormatter)
{
// This method finds all linked .resx files for the .resx file that is passed in.
// filename is the filename of the .resx file that is to be examined.
@ -270,7 +270,7 @@ namespace Microsoft.Build.Tasks
if (useMSBuildResXReader)
{
foreach (IResource resource in MSBuildResXReader.GetResourcesFromFile(filename, pathsRelativeToBasePath: baseLinkedFileDirectory == null))
foreach (IResource resource in MSBuildResXReader.GetResourcesFromFile(filename, pathsRelativeToBasePath: baseLinkedFileDirectory == null, log, logWarningForBinaryFormatter))
{
if (resource is FileStreamResource linkedResource)
{

Просмотреть файл

@ -9,6 +9,7 @@ using System.Text;
using System.Xml;
using System.Xml.Linq;
using Microsoft.Build.Shared;
using Microsoft.Build.Utilities;
#nullable disable
@ -16,7 +17,7 @@ namespace Microsoft.Build.Tasks.ResourceHandling
{
internal class MSBuildResXReader
{
public static IReadOnlyList<IResource> ReadResources(Stream s, string filename, bool pathsRelativeToBasePath)
public static IReadOnlyList<IResource> ReadResources(Stream s, string filename, bool pathsRelativeToBasePath, TaskLoggingHelper log, bool logWarningForBinaryFormatter)
{
var resources = new List<IResource>();
var aliases = new Dictionary<string, string>();
@ -38,7 +39,7 @@ namespace Microsoft.Build.Tasks.ResourceHandling
case "resheader":
break;
case "data":
ParseData(filename, pathsRelativeToBasePath, resources, aliases, elem);
ParseData(filename, pathsRelativeToBasePath, resources, aliases, elem, log, logWarningForBinaryFormatter);
break;
}
}
@ -101,7 +102,14 @@ namespace Microsoft.Build.Tasks.ResourceHandling
return aliasedTypeName;
}
private static void ParseData(string resxFilename, bool pathsRelativeToBasePath, List<IResource> resources, Dictionary<string, string> aliases, XElement elem)
private static void ParseData(
string resxFilename,
bool pathsRelativeToBasePath,
List<IResource> resources,
Dictionary<string, string> aliases,
XElement elem,
TaskLoggingHelper log,
bool logWarningForBinaryFormatter)
{
string name = elem.Attribute("name").Value;
string value;
@ -186,6 +194,12 @@ namespace Microsoft.Build.Tasks.ResourceHandling
case BinSerializedObjectMimeType:
case Beta2CompatSerializedObjectMimeType:
case CompatBinSerializedObjectMimeType:
// Warn of BinaryFormatter exposure (SDK should turn this on by default in .NET 8+)
if (logWarningForBinaryFormatter)
{
log?.LogWarningWithCodeFromResources(null, resxFilename, ((IXmlLineInfo)elem).LineNumber, ((IXmlLineInfo)elem).LinePosition, 0, 0, "GenerateResource.BinaryFormatterUse", name, typename);
}
// BinaryFormatter from byte array
byte[] binaryFormatterBytes = Convert.FromBase64String(value);
@ -284,19 +298,19 @@ namespace Microsoft.Build.Tasks.ResourceHandling
/// <summary>
/// Extract <see cref="IResource"/>s from a given file on disk.
/// </summary>
public static IReadOnlyList<IResource> GetResourcesFromFile(string filename, bool pathsRelativeToBasePath)
public static IReadOnlyList<IResource> GetResourcesFromFile(string filename, bool pathsRelativeToBasePath, TaskLoggingHelper log, bool logWarningForBinaryFormatter)
{
using (var x = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return ReadResources(x, filename, pathsRelativeToBasePath);
return ReadResources(x, filename, pathsRelativeToBasePath, log, logWarningForBinaryFormatter);
}
}
public static IReadOnlyList<IResource> GetResourcesFromString(string resxContent, string basePath = null, bool? useRelativePath = null)
public static IReadOnlyList<IResource> GetResourcesFromString(string resxContent, TaskLoggingHelper log, bool logWarningForBinaryFormatter, string basePath = null, bool? useRelativePath = null)
{
using (var x = new MemoryStream(Encoding.UTF8.GetBytes(resxContent)))
{
return ReadResources(x, basePath, useRelativePath.GetValueOrDefault(basePath != null));
return ReadResources(x, basePath, useRelativePath.GetValueOrDefault(basePath != null), log, logWarningForBinaryFormatter);
}
}

Просмотреть файл

@ -1161,6 +1161,11 @@
<value>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</value>
<comment>{StrBegin="MSB3824: "}</comment>
</data>
<data name="GenerateResource.BinaryFormatterUse">
<value>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</value>
<comment>{StrBegin="MSB3825: "}</comment>
</data>
<!--

7
src/Tasks/Resources/xlf/Strings.cs.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: Funkce ClickOnce nepodporuje požadovanou úroveň provedení {0}.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: Aby bylo možné provést sestavení pomocí .NET Core, musí být vstupy prostředků ve formátu .txt nebo .resx.</target>

7
src/Tasks/Resources/xlf/Strings.de.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: Die Anforderungsausführungsebene "{0}" wird von ClickOnce nicht unterstützt.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: Für die Kompilierung mit .NET Core müssen Ressourceneingaben im TXT- oder RESX-Format vorliegen.</target>

7
src/Tasks/Resources/xlf/Strings.es.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce no admite el nivel de ejecución de solicitudes '{0}'.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: Para compilar con .NET Core, las entradas de recursos deben estar en formato .txt o .resx.</target>

7
src/Tasks/Resources/xlf/Strings.fr.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce ne prend pas en charge le niveau d'exécution de la requête '{0}'.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: Pour pouvoir générer avec .NET Core, les entrées de ressource doivent être au format .txt ou .resx.</target>

7
src/Tasks/Resources/xlf/Strings.it.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce non supporta il livello di esecuzione richieste '{0}'.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: per compilare con .NET Core, gli input delle risorse devono essere in formato. txt o. resx.</target>

7
src/Tasks/Resources/xlf/Strings.ja.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce では、要求の実行レベル '{0}' はサポートされていません。</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: .NET Core を使用してビルドするには、リソースの入力を .txt 形式または .resx 形式にする必要があります。</target>

7
src/Tasks/Resources/xlf/Strings.ko.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce는 요청 실행 수준 '{0}'을(를) 지원하지 않습니다.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: .NET Core로 빌드하려면 리소스 입력이 .txt 또는 .resx 형식이어야 합니다.</target>

7
src/Tasks/Resources/xlf/Strings.pl.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: Funkcja ClickOnce nie obsługuje poziomu wykonania żądania „{0}”.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: Aby kompilować przy użyciu platformy .NET Core, dane wejściowe zasobów muszą być w formacie txt lub resx.</target>

7
src/Tasks/Resources/xlf/Strings.pt-BR.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: O ClickOnce não dá suporte ao nível de execução de solicitação "{0}".</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: Para compilar com o .NET Core, as entradas de recurso devem estar em formato .txt ou .resx.</target>

7
src/Tasks/Resources/xlf/Strings.ru.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce не поддерживает уровень выполнения запроса "{0}".</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: для сборки с использованием .NET Core входные данные ресурсов должны быть в формате TXT или RESX.</target>

7
src/Tasks/Resources/xlf/Strings.tr.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce, '{0}' istek yürütme düzeyini desteklemiyor.</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: .NET Core ile derlemek için kaynak girişleri .txt veya .resx biçiminde olmalıdır.</target>

7
src/Tasks/Resources/xlf/Strings.zh-Hans.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce 不支持请求执行级别“{0}”。</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: 要使用 .NET Core 进行生成,资源输入必须为 .txt 或 .resx 格式。</target>

7
src/Tasks/Resources/xlf/Strings.zh-Hant.xlf сгенерированный
Просмотреть файл

@ -1039,6 +1039,13 @@
<target state="translated">MSB3190: ClickOnce 不支援要求執行層級 '{0}'。</target>
<note>{StrBegin="MSB3190: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.BinaryFormatterUse">
<source>MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</source>
<target state="new">MSB3825: Resource "{0}" of type "{1}" is deserialized via BinaryFormatter at runtime. BinaryFormatter is deprecated due to possible security risks and will be removed with .NET 9. If you wish to continue using it, set property "GenerateResourceWarnOnBinaryFormatterUse" to false.
More information: https://learn.microsoft.com/dotnet/standard/serialization/binaryformatter-security-guide</target>
<note>{StrBegin="MSB3825: "}</note>
</trans-unit>
<trans-unit id="GenerateResource.CoreSupportsLimitedScenarios">
<source>MSB3824: In order to build with .NET Core, resource inputs must be in .txt or .resx format.</source>
<target state="translated">MSB3824: 若要使用 .NET Core 建置,資源輸入必須採用 .txt 或 .resx 格式。</target>