CodeGen.proj 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <Project>
  2. <PropertyGroup>
  3. <BuildManaged>true</BuildManaged>
  4. <RepoRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..'))</RepoRoot>
  5. <BuildMainlyReferenceProviders>true</BuildMainlyReferenceProviders>
  6. </PropertyGroup>
  7. <Import Project="Build.props" />
  8. <Target Name="GenerateProjectList">
  9. <Message Importance="High" Text="Analyzing @(ProjectToBuild->Count()) projects" />
  10. <MSBuild Projects="@(ProjectToBuild)"
  11. Targets="GetReferencesProvided"
  12. BuildInParallel="true"
  13. SkipNonexistentTargets="true"
  14. SkipNonexistentProjects="true" >
  15. <Output TaskParameter="TargetOutputs" ItemName="_ProjectReferenceProvider"/>
  16. </MSBuild>
  17. <ItemGroup>
  18. <_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsShippingPackage', 'true')->Distinct())" />
  19. <_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsShippingPackage', 'false')->Distinct())" />
  20. <_ProjectReferenceProviderWithRefAssembly Include="@(_ProjectReferenceProvider->HasMetadata('ReferenceAssemblyProjectFileRelativePath'))" />
  21. <_ProjectReferenceProvider Remove="@(_ProjectReferenceProviderWithRefAssembly)" />
  22. </ItemGroup>
  23. <PropertyGroup>
  24. <ProjectListFile>$(MSBuildThisFileDirectory)ProjectReferences.props</ProjectListFile>
  25. <ProjectListContent><![CDATA[<!--
  26. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  27. This file contains a map of assembly names to the projects that build them.
  28. -->
  29. <Project>
  30. <ItemGroup>
  31. @(_ProjectReferenceProvider->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" />', '%0A ')
  32. @(_ProjectReferenceProviderWithRefAssembly->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" RefProjectPath="%24(RepoRoot)%(ReferenceAssemblyProjectFileRelativePath)" />', '%0A ')
  33. </ItemGroup>
  34. </Project>
  35. ]]></ProjectListContent>
  36. </PropertyGroup>
  37. <!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
  38. <WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
  39. File="$(ProjectListFile)" Lines="$([MSBuild]::Escape($(ProjectListContent)))" Overwrite="true" />
  40. <Exec Condition="'$(OS)' != 'Windows_NT'"
  41. Command="echo '$(ProjectListContent.Replace('\t','\\t'))' > $(ProjectListFile)" />
  42. <Message Importance="High" Text="Generated $(ProjectListFile)" />
  43. <PropertyGroup>
  44. <SharedFxDepList>$(MSBuildThisFileDirectory)SharedFramework.Local.props</SharedFxDepList>
  45. <SharedFxDepListContent>
  46. <![CDATA[
  47. <!--
  48. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  49. This file contains a complete list of the assemblies which are part of the shared framework.
  50. This project is generated using the <IsAspNetCoreApp> and <IsShippingPackage> properties from each .csproj in this repository.
  51. -->
  52. <Project>
  53. <ItemGroup>
  54. <!-- These assemblies are available as both a NuGet package and in the shared framework -->
  55. @(_SharedFrameworkAndPackageRef->'<AspNetCoreAppReferenceAndPackage Include="%(Identity)" />', '%0A ')
  56. <!-- These assemblies are only in the shared framework -->
  57. @(_SharedFrameworkRef->'<AspNetCoreAppReference Include="%(Identity)" />', '%0A ')
  58. </ItemGroup>
  59. </Project>
  60. ]]>
  61. </SharedFxDepListContent>
  62. </PropertyGroup>
  63. <WriteLinesToFile File="$(SharedFxDepList)" Lines="$(SharedFxDepListContent)" Overwrite="true" />
  64. <Message Importance="High" Text="Generated $(SharedFxDepList)" />
  65. </Target>
  66. <Target Name="GenerateReferenceSources">
  67. <MSBuild
  68. Projects="@(ProjectToBuild)"
  69. Targets="GenerateReferenceSource"
  70. SkipNonexistentTargets="true"
  71. SkipNonexistentProjects="true" />
  72. </Target>
  73. </Project>