|
41 | 41 | </Target> |
42 | 42 |
|
43 | 43 | <!-- |
44 | | - This target writes a PackageId.props file that will get packed into build/ folder in NuGet. |
45 | | - That props file adds the path to the Plugin dll to the CodeGenerationRoslynPlugin ItemGroup, |
46 | | - so that CodeGeneration.Roslyn tooling can read and load generator plugins. |
| 44 | + This target writes PackageId.props/targets files that will get packed into build/ folder in NuGet. |
| 45 | + Those MSBuild files add the path to the Plugin dll to the CodeGenerationRoslynPlugin ItemGroup, |
| 46 | + so that CodeGeneration.Roslyn tooling can read and load generator plugins, and additionally |
| 47 | + create a target that checks whether the Tool targets were imported, and warns if they weren't. |
| 48 | +
|
| 49 | + It also imports any PackageBuildFolderProjectImport items as per extension - .props in .props, |
| 50 | + .targets in .targets. It doesn't handle actually packaging those files correctly. |
47 | 51 | --> |
48 | 52 | <Target Name="CreatePluginPackageBuildProps" |
49 | 53 | DependsOnTargets="DefinePluginPackagePath" |
50 | 54 | Condition=" '$(PackAsCodeGenerationRoslynPlugin)' == 'true' "> |
| 55 | + <ItemGroup> |
| 56 | + <_PackageBuildFolderProjectImport_props Include="@(PackageBuildFolderProjectImport->Distinct())" Condition=" '%(Extension)' == '.props' " /> |
| 57 | + <_PackageBuildFolderProjectImport_targets Include="@(PackageBuildFolderProjectImport->Distinct())" Condition=" '%(Extension)' == '.targets' " /> |
| 58 | + </ItemGroup> |
51 | 59 | <PropertyGroup> |
52 | 60 | <PackagePropsContent> |
53 | 61 | <![CDATA[ |
54 | 62 | <?xml version="1.0" encoding="utf-8" ?> |
55 | 63 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 64 | +@(_PackageBuildFolderProjectImport_props->' <Import Project="%(Identity)" />', '%0D%0A') |
56 | 65 | <ItemGroup> |
57 | 66 | <CodeGenerationRoslynPlugin Include="%24(MSBuildThisFileDirectory)../$(PluginPackagePath)/$(TargetFileName)" /> |
58 | 67 | </ItemGroup> |
|
63 | 72 | <![CDATA[ |
64 | 73 | <?xml version="1.0" encoding="utf-8" ?> |
65 | 74 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 75 | +@(_PackageBuildFolderProjectImport_targets->' <Import Project="%(Identity)" />', '%0D%0A') |
66 | 76 | <Target Name="CheckCgrToolUsed" BeforeTargets="Build"> |
67 | 77 | <Warning Condition=" '%24(UsingCodeGenerationRoslynToolTargets)' != 'true' " Text="CodeGeneration.Roslyn.Tool build targets weren't detected. CG.R Plugins (generators) won't be run without importing targets from the CodeGeneration.Roslyn.Tool package (v$(PackageVersion))." /> |
68 | 78 | </Target> |
|
0 commit comments