Skip to content
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

doesn't work with dotnet aspnet-codegenerator #141

Open
pgrm opened this issue Aug 20, 2020 · 3 comments
Open

doesn't work with dotnet aspnet-codegenerator #141

pgrm opened this issue Aug 20, 2020 · 3 comments
Labels

Comments

@pgrm
Copy link

pgrm commented Aug 20, 2020

Hello, when I run dotnet aspnet-codegenerator identity I get errors, that it can't find the auto generated constructors. Specifically: Failed to compile the project in memory

Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
Failed to compile the project in memory
/Users/peter/dev/.../File1.cs(50,21): error CS1729: 'YourClass' does not contain a constructor that takes 2 arguments
/Users/peter/dev/.../File2.cs(48,36): error CS1729: 'YourClass' does not contain a constructor that takes 2 arguments
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)

dotnet build works of course, so I'm wondering if this is an issue with the aspnet-codegenerator tool chain, or rather with the way the RecordGenerator registers itself for the builds.

Thanks for your help

@amis92
Copy link
Owner

amis92 commented Aug 20, 2020

Hi. I haven't used dotnet asp-codegenerator, but indeed indeed, there will always be issues when you use two different code generation frameworks.

RecordGenerator uses CodeGeneration.Roslyn underneath: https://github.com/AArnott/CodeGeneration.Roslyn

I won't have time to debug how aspnet-codegenerator runs MSBuild targets, but it should be possible. Have you tried building the project via dotnet build and then running dotnet aspnet-codegenerator identity --no-build?

@pgrm
Copy link
Author

pgrm commented Aug 22, 2020

@amis92 thx for getting back to me, yes we tried that, and it's still saying Failed to compile the project in memory - the aspnet-generator is different from yours, as it should be rather similar to ef core migrations (which by the way work just fine), in the sense that the aspnet-generator should simply scaffold some views / models / ... which will be afterwards committed into the repository.

Ok, I'll get in touch with the repository where the generator is hosted and ask there as well 😃

@12345-daredevil
Copy link

@pgrm Hello. I have this problem too. How did you solve this error?

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

No branches or pull requests

3 participants