Open dszryan opened 3 years ago
You'll probably want to add the GenerateCodeFromAttributes
MSBuild target to a DependsOn
property of the other generators' MSBuild target.
yup - that worked.
to be precise, took the following steps.
in the project/s with the attributes and the codegen classes:
<ItemGroup>
<PackageReference Include="CodeGeneration.Roslyn.Tool" Version="{replace with actual veetrsion used}" />
</ItemGroup>
<Target Name="RunCodeGenerationRoslynFirst" BeforeTargets="Build">
<CallTarget Targets="GenerateCodeFromAttributes" />
</Target>
NB: added the following to the project with the custom CGR attributes/codegens and not the other generators MSBuild target
BeforeTargets
for the RunCodeGenerationRoslynFirst
task can be easily updated based on inspection of the other codegen/s default targetsif there could be a better way - do advise, else please close the ticket.
If you can share what exactly is that other generator, I could look and advise.
As is, your solution looks like a hacky one. Maybe a better one can be written.
https://github.com/AArnott/CodeGeneration.Roslyn/wiki/Features#definitions
Please use terms as defined, so I'll be able to understand you quickly.
For a quick enhancement, you could replace CallTarget, which is rarely a good idea, with DependsOn=Generate... in your custom target.
how can one ensure CGR is the first to run in the presence of multiple code generation/s in the build pipeline?