Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Starting in .NET 10, the XsltSettings.EnableScript property is marked obsolete.
Reason for obsoletion
XSLT script blocks aren't supported on .NET (Core). Previously, if you set the property to true, a PlatformNotSupportedException was thrown at run time. This obsoletion turns a run-time error into a build warning, which provides better guidance for migration.
Workaround
Review call sites for any assumptions made about the behavior of this property. You can likely remove any references to the property since it didn't truly enable script blocks on modern .NET.
Suppress a warning
If you must use the obsolete API, you can suppress the warning in code or in your project file.
To suppress only a single violation, add preprocessor directives to your source file to disable and then re-enable the warning.
// Disable the warning.
#pragma warning disable SYSLIB0062
// Code that uses obsolete API.
// ...
// Re-enable the warning.
#pragma warning restore SYSLIB0062
To suppress all the SYSLIB0062 warnings in your project, add a <NoWarn> property to your project file.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
...
<NoWarn>$(NoWarn);SYSLIB0062</NoWarn>
</PropertyGroup>
</Project>
For more information, see Suppress warnings.