aspnetcore/eng/Workarounds.targets

82 строки
4.4 KiB
XML

<!-- Use this file to workaround issues. List the issue tracking the item to fix so we can remove the workaround when the issue is resolved. -->
<Project>
<!-- Workaround while there is no 5.0 SDK available, suppress unsupported version error -->
<PropertyGroup>
<NETCoreAppMaximumVersion>5.0</NETCoreAppMaximumVersion>
</PropertyGroup>
<ItemGroup>
<!-- Reference base shared framework at incoming dependency flow version, not bundled sdk version. -->
<FrameworkReference
Update="Microsoft.NETCore.App"
Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'"
RuntimeFrameworkVersion="$(MicrosoftNETCoreAppRuntimeVersion)"
TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)"
/>
</ItemGroup>
<!--
Workaround https://github.com/dotnet/aspnetcore/issues/4257.
The web sdk adds an implicit framework reference. This removes it until we can update our build to use framework references.
-->
<ItemGroup>
<FrameworkReference Remove="Microsoft.AspNetCore.App" />
<!-- Required because the Razor SDK will generate attributes -->
<Reference Include="Microsoft.AspNetCore.Mvc" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(GenerateRazorAssemblyInfo)' == 'true'" />
</ItemGroup>
<!-- Workaround https://github.com/dotnet/aspnetcore/issues/7503. This chains GenerateSourceLinkFile before razor component targets run. -->
<!-- Workaround https://github.com/dotnet/source-build/issues/1112. Source link is currently disabled in source build so do not apply this worksaround. -->
<Target Condition="'$(DotNetBuildFromSource)' != 'true'"
Name="_EnsureSourceLinkHappensBeforeRazorComponentGeneration"
BeforeTargets="PrepareForRazorComponentGenerate"
DependsOnTargets="GenerateSourceLinkFile" />
<!-- Workaround https://github.com/dotnet/source-build/issues/1112. Source link is currently disabled in source build so define this dummy target which is required for pack. -->
<Import Condition="'$(DotNetBuildFromSource)' == 'true'" Project="WorkaroundsImported.targets" />
<!-- Workaround for https://github.com/dotnet/arcade/issues/204, not needed in source build -->
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<PackageReference Include="Internal.AspNetCore.BuildTasks" PrivateAssets="All" Version="$(InternalAspNetCoreBuildTasksPackageVersion)" IsImplicitlyDefined="true" />
</ItemGroup>
<ItemGroup>
<!-- Workaround when there is no vNext SDK available, copy known apphost/framework reference info from 3.0 -->
<KnownAppHostPack
Include="@(KnownAppHostPack->WithMetadataValue('TargetFramework', 'netcoreapp3.0'))"
TargetFramework="$(DefaultNetCoreTargetFramework)"
Condition="@(KnownAppHostPack->Count()) != '0' AND !(@(KnownAppHostPack->AnyHaveMetadataValue('TargetFramework', '$(DefaultNetCoreTargetFramework)')))"
/>
<KnownFrameworkReference
Include="@(KnownFrameworkReference->WithMetadataValue('TargetFramework', 'netcoreapp3.0'))"
TargetFramework="$(DefaultNetCoreTargetFramework)"
Condition="@(KnownFrameworkReference->Count()) != '0' AND !(@(KnownFrameworkReference->AnyHaveMetadataValue('TargetFramework', '$(DefaultNetCoreTargetFramework)')))"
/>
</ItemGroup>
<!-- Workaround for netstandard2.1 projects until we can get a preview 8 SDK containing https://github.com/dotnet/sdk/pull/3463 fix. -->
<ItemGroup>
<KnownFrameworkReference Update="NETStandard.Library">
<RuntimeFrameworkName>NETStandard.Library</RuntimeFrameworkName>
</KnownFrameworkReference>
</ItemGroup>
<!-- Work around https://github.com/dotnet/cli/issues/11378. -->
<Target Name="_WorkaroundNetStandard" AfterTargets="ResolvePackageAssets">
<ItemGroup>
<TransitiveFrameworkReference Remove="NETStandard.Library" />
</ItemGroup>
</Target>
<!-- Work around https://github.com/dotnet/aspnetcore/issues/18393 -->
<Target Name="_UpdateRazorGenerateAssemblyReferences"
AfterTargets="ResolveAssemblyReferenceRazorGenerateInputs"
DependsOnTargets="FindReferenceAssembliesForReferences"
Condition="'$(CompileUsingReferenceAssemblies)' != 'false'">
<ItemGroup>
<RazorReferencePath Remove="@(ReferencePath)" />
<RazorReferencePath Include="@(ReferencePathWithRefAssemblies)" />
</ItemGroup>
</Target>
</Project>