--- /dev/null
+<Project InitialTargets="_RedefineNotSupportedSourceFile">
+
+ <Target Name="_RedefineNotSupportedSourceFile"
+ Condition="'$(DotNetBuildFromSource)' == 'true' and
+ ('$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != '')">
+
+ <Error Condition="'$(DotNetSourceBuildIntermediatePath)' == ''"
+ Text="'DotNetSourceBuildIntermediatePath' must be specified when 'DotNetBuildFromSource' is true" />
+
+ <PropertyGroup>
+ <_notSupportedSourceDirectory>$([MSBuild]::NormalizeDirectory('$(DotNetSourceBuildIntermediatePath)', '$(MSBuildProjectName)', '$(TargetGroup)-$(OSGroup)'))</_notSupportedSourceDirectory>
+ <NotSupportedSourceFile>$(_notSupportedSourceDirectory)$(TargetName).notsupported.cs</NotSupportedSourceFile>
+ </PropertyGroup>
+
+ <MakeDir Condition="'$(OfflineBuild)' != 'true'" Directories="$(_notSupportedSourceDirectory)" />
+
+ <Error Condition="'$(OfflineBuild)' == 'true' AND !Exists('$(NotSupportedSourceFile)')"
+ Text="Error NotSupportedSourceFile '$(NotSupportedSourceFile)' did not exist under DotNetSourceBuildIntermediatePath." />
+
+ <!-- OfflineBuild == true, don't use GenAPI and include source from DotNetSourceBuildIntermediatePath -->
+ <ItemGroup Condition="'$(OfflineBuild)' == 'true'">
+ <Compile Include="$(NotSupportedSourceFile)" />
+ </ItemGroup>
+ </Target>
+</Project>
\ No newline at end of file