I find that The package:Microsoft.VisualStudio.CodeGeneration has over 20,000,000 downloads in the nuget.but I can not find any doc.
how to use it?
any articles about it?
Basically, the package offers a single command to generate code:
dotnet aspnet-codegenerator {name}
You can find the source code here.
We don't use the Microsoft.VisualStudio.Web.CodeGeneration
directly unless we're creating a new command to generate code.
Because it is a command library for generic purpose, concrete commands are defined in other packages. For example, the dotnet aspnet-codegenerator controller
command is defined in Microsoft.VisualStudio.Web.CodeGenerators.Mvc. And the command dotnet aspnet-codegenerator identity
is also defined in the CG.MVC
package.
Usually , since this package is a generic purpose library, you won't reference this package directly. Instead, You'll add the package Microsoft.VisualStudio.Web.CodeGeneration.Design
. Be aware the Microsoft.VisualStudio.Web.CodeGeneration.Design
package has a dependency on Microsoft.VisualStudio.Web.CodeGenerators.Mvc
, and the Microsoft.VisualStudio.Web.CodeGenerators.Mvc
depends on Microsoft.VisualStudio.Web.CodeGeneration
:
Microsoft.VisualStudio.Web.CodeGeneration.Design | |(depends on) |-----------> Microsoft.VisualStudio.Web.CodeGenerators.Mvc | |(depends on) |-----------> Microsoft.VisualStudio.Web.CodeGeneration
Be aware the Microsoft.VisualStudio.Web.CodeGeneration.Design
is automatically added into your dependencies when you use Visual Studio to scaffold a controller/identity.
If you're using a VSCode/CLI, you need to manually add such a package reference. See https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/adding-model?view=aspnetcore-3.0&tabs=visual-studio-code#add-nuget-packages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With