Workarounds.targets 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <!-- 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. -->
  2. <Project>
  3. <!-- Workaround while there is no 5.0 SDK available, suppress unsupported version error -->
  4. <PropertyGroup>
  5. <NETCoreAppMaximumVersion>5.0</NETCoreAppMaximumVersion>
  6. </PropertyGroup>
  7. <ItemGroup>
  8. <!-- Reference base shared framework at incoming dependency flow version, not bundled sdk version. -->
  9. <FrameworkReference
  10. Update="Microsoft.NETCore.App"
  11. Condition="'$(TargetFramework)' == '$(DefaultNetCoreTargetFramework)'"
  12. RuntimeFrameworkVersion="$(MicrosoftNETCoreAppRuntimeVersion)"
  13. TargetingPackVersion="$(MicrosoftNETCoreAppRefPackageVersion)"
  14. />
  15. </ItemGroup>
  16. <!--
  17. Workaround https://github.com/aspnet/AspNetCore/issues/4257.
  18. The web sdk adds an implicit framework reference. This removes it until we can update our build to use framework references.
  19. -->
  20. <ItemGroup>
  21. <FrameworkReference Remove="Microsoft.AspNetCore.App" />
  22. <!-- Required because the Razor SDK will generate attributes -->
  23. <Reference Include="Microsoft.AspNetCore.Mvc" Condition="'$(UsingMicrosoftNETSdkWeb)' == 'true' AND '$(TargetFrameworkIdentifier)' == '.NETCoreApp' AND '$(GenerateRazorAssemblyInfo)' == 'true'" />
  24. </ItemGroup>
  25. <!-- Workaround https://github.com/aspnet/AspNetCore/issues/7503. This chains GenerateSourceLinkFile before razor component targets run. -->
  26. <!-- Workaround https://github.com/dotnet/source-build/issues/1112. Source link is currently disabled in source build so do not apply this worksaround. -->
  27. <Target Condition="'$(DotNetBuildFromSource)' != 'true'"
  28. Name="_EnsureSourceLinkHappensBeforeRazorComponentGeneration"
  29. BeforeTargets="PrepareForRazorComponentGenerate"
  30. DependsOnTargets="GenerateSourceLinkFile" />
  31. <!-- 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. -->
  32. <Import Condition="'$(DotNetBuildFromSource)' == 'true'" Project="WorkaroundsImported.targets" />
  33. <!-- Workaround for https://github.com/dotnet/arcade/issues/204, not needed in source build -->
  34. <ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
  35. <PackageReference Include="Internal.AspNetCore.BuildTasks" PrivateAssets="All" Version="$(InternalAspNetCoreBuildTasksPackageVersion)" IsImplicitlyDefined="true" />
  36. </ItemGroup>
  37. <ItemGroup>
  38. <!-- Workaround when there is no vNext SDK available, copy known apphost/framework reference info from 3.0 -->
  39. <KnownAppHostPack
  40. Include="@(KnownAppHostPack->WithMetadataValue('TargetFramework', 'netcoreapp3.0'))"
  41. TargetFramework="$(DefaultNetCoreTargetFramework)"
  42. Condition="@(KnownAppHostPack->Count()) != '0' AND !(@(KnownAppHostPack->AnyHaveMetadataValue('TargetFramework', '$(DefaultNetCoreTargetFramework)')))"
  43. />
  44. <KnownFrameworkReference
  45. Include="@(KnownFrameworkReference->WithMetadataValue('TargetFramework', 'netcoreapp3.0'))"
  46. TargetFramework="$(DefaultNetCoreTargetFramework)"
  47. Condition="@(KnownFrameworkReference->Count()) != '0' AND !(@(KnownFrameworkReference->AnyHaveMetadataValue('TargetFramework', '$(DefaultNetCoreTargetFramework)')))"
  48. />
  49. </ItemGroup>
  50. <!-- Workaround for netstandard2.1 projects until we can get a preview 8 SDK containing https://github.com/dotnet/sdk/pull/3463 fix. -->
  51. <ItemGroup>
  52. <KnownFrameworkReference Update="NETStandard.Library">
  53. <RuntimeFrameworkName>NETStandard.Library</RuntimeFrameworkName>
  54. </KnownFrameworkReference>
  55. </ItemGroup>
  56. <!-- Work around https://github.com/dotnet/cli/issues/11378. -->
  57. <Target Name="_WorkaroundNetStandard" AfterTargets="ResolvePackageAssets">
  58. <ItemGroup>
  59. <TransitiveFrameworkReference Remove="NETStandard.Library" />
  60. </ItemGroup>
  61. </Target>
  62. </Project>