prafullbhosale / CustomScaffolder

3 stars 2 forks source link

Debugging scaffolding .net core #2

Open ti994a7 opened 6 years ago

ti994a7 commented 6 years ago

I saw your answer about debugging on the main scaffolding repository, and I have another question. It really isn't an issue, but more of a question, and I wasn't sure how else to contact you, so I apologize for creating an issue in this repository, but I'm hoping that you might be able to help me.

I followed your instructions and was able to put breakpoints in the scaffolding assemblies, however I am wondering if it is possible to put breakpoints in the template files themselves. Similar to the way that you can place breakpoints in a view for debugging? Thank you in advance for any assistance that you may be able to provide.

prafullbhosale commented 6 years ago

Unfortunately, I don't know if what you are asking exactly could be done. However, the C# code that gets generated from the .cshtml file can be seen by putting a breakpoint here: https://github.com/aspnet/Scaffolding/blob/dev/src/VS.Web.CG.Templating/RazorTemplating.cs#L55

Hopefully that helps you get going.

gkochanowsky commented 4 years ago

I've tried to port this project over to Core 3.1. When I try to run the generator I get:

PM> dotnet aspnet-codegenerator sample -h

Usage: aspnet-codegenerator [arguments] [options]

Arguments: generator Name of the generator. Check available generators below.

Options: -p|--project Path to .csproj file in the project. -n|--nuget-package-dir
-c|--configuration Configuration for the project (Possible values: Debug/ Release) -tfm|--target-framework Target Framework to use. (Short folder name of the tfm. eg. net46) -b|--build-base-path
--no-build

Selected Code Generator: sample No code generator found with the name 'sample'.

Available generators: area : Generates an MVC Area. controller: Generates a controller. identity : Generates an MVC Area with controllers and razorpage : Generates RazorPage(s). view : Generates a view.

RunTime 00:00:02.44 PM>

It looks like it can't find the custom generator. Please advise.