Skip to content

Source generation when models are in a separate project #1511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wayne-o opened this issue Mar 20, 2024 · 1 comment · Fixed by #1515
Closed

Source generation when models are in a separate project #1511

wayne-o opened this issue Mar 20, 2024 · 1 comment · Fixed by #1515
Labels

Comments

@wayne-o
Copy link
Contributor

wayne-o commented Mar 20, 2024

We have the following structure:

  • CompanyName.Models (only has reference to JADNC.Annotations)
    • Model.cs
    • DbContext.cs
    • Migrations
    • etc etc
  • CompanyName.Web (has reference to full JADNC package)
    • Program.cs

I was hoping that the source gen would happen in CompanyName.Web since it has a reference to CompanyName.Models but that doesn't seem to be the case?

We don't want to have to add a reference to the full package in the Models project and we would prefer to not pulute that project with controllers. Is there any way around this?

@bkoelman
Copy link
Member

Understandable. This is a limitation of using source generators. They operate at the project level. I'm not aware of a way to fix that.

In your case, it requires to turn it off and define controllers manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants