Preload System.Text.Json 8.0.0.4

This works around dotnet/sdk#43339 by preloading a copy of the assembly
that can't be located with the normal load processes. It should be
harmless (other than wasting time) in circumstances where it's not
necessary.
This commit is contained in:
Rainer Sigwald 2024-09-11 11:35:48 -05:00
Родитель d93deee6ea
Коммит 2e8f2dcf94
1 изменённых файлов: 26 добавлений и 0 удалений

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

@ -37,4 +37,30 @@
<RemoveDir Directories="$(_PackageFolderInGlobalPackages)"
Condition="Exists('$(_PackageFolderInGlobalPackages)')" />
</Target>
<!-- BEGIN workaround for https://github.com/dotnet/sdk/issues/43339; remove after updated to VS 17.12 or a future 17.11 patch -->
<Target Name="WorkaroundDotnetSdk43339" BeforeTargets="ResolvePackageAssets" Condition=" '$(MSBuildRuntimeType)' == 'Full' and $([MSBuild]::VersionLessThan($(MSBuildVersion), 17.12.0))">
<PrimeSystemTextJson804 />
</Target>
<UsingTask
TaskName="PrimeSystemTextJson804"
TaskFactory="RoslynCodeTaskFactory"
AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll" >
<Task>
<Code Type="Fragment" Language="cs">
<![CDATA[
try
{
System.Reflection.Assembly.LoadFrom(@"$(MicrosoftNETBuildTasksDirectoryRoot)\..\..\..\DotnetTools\dotnet-format\BuildHost-net472\System.Text.Json.dll");
}
catch
{
// Best effort: if something moves in the SDK don't break the build.
}
]]>
</Code>
</Task>
</UsingTask>
<!-- END workaround for https://github.com/dotnet/sdk/issues/43339 -->
</Project>