Coder Social home page Coder Social logo

Comments (4)

amis92 avatar amis92 commented on July 30, 2024

You'll probably want to add the GenerateCodeFromAttributes MSBuild target to a DependsOn property of the other generators' MSBuild target.

<Target
Name="GenerateCodeFromAttributes"
Condition=" '$(UsingCodeGenerationRoslynToolTargets)' != 'false' "
DependsOnTargets="$(GenerateCodeFromAttributesDependsOn)"
BeforeTargets="CoreCompile;PrepareResources">
</Target>

from codegeneration.roslyn.

dszryan avatar dszryan commented on July 30, 2024

yup - that worked.

to be precise, took the following steps.

in the project/s with the attributes and the codegen classes:

  1. added the reference to the nuget tool package
    <ItemGroup>
        <PackageReference Include="CodeGeneration.Roslyn.Tool" Version="{replace with actual veetrsion used}" />
    </ItemGroup>
  1. and the following target
    <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

  • adding the depends on the other codegen/s would require building a custom build for its nuget package
  • BeforeTargets for the RunCodeGenerationRoslynFirst task can be easily updated based on inspection of the other codegen/s default targets
  • this does cause the problem when makes changes to custom CGR project, would require two builds to take effect. but an easy workaround could be to have two have separate project files - one for development and the other for usage (with the above target)

if there could be a better way - do advise, else please close the ticket.

from codegeneration.roslyn.

amis92 avatar amis92 commented on July 30, 2024

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.

from codegeneration.roslyn.

amis92 avatar amis92 commented on July 30, 2024

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.

from codegeneration.roslyn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.