Я пытаюсь создать генератор кода для библиотеки классов, используя YeoMan
.
Вот что я попробовал, как упомянуто ниже:
E:\Learnings\YeoMan Code Generator>mkdir YeoManClassLibrary
E:\Learnings\YeoMan Code Generator>cd YeoManClassLibrary
E:\Learnings\YeoMan Code Generator\YeoManClassLibrary>yo generator-aspnet
Installed generators don't need the "generator-" prefix.
In the future, run yo aspnet instead!
_-----_ ╭──────────────────────────╮
| | │ Welcome to the │
|--(o)--| │ marvellous ASP.NET Core │
`---------´ │ generator! │
( _´U`_ ) ╰──────────────────────────╯
/___A___\ /
| ~ |
__'.___.'__
´ ` |° ´ Y `
? What type of application do you want to create? Class Library
? What's the name of your ASP.NET application? MyClassLibrary
create MyClassLibrary\.gitignore
create MyClassLibrary\Class1.cs
create MyClassLibrary\MyClassLibrary.csproj
create MyClassLibrary\global.json
Your project is now created, you can use the following commands to get going
cd "MyClassLibrary"
dotnet restore
dotnet build (optional, build will also happen when it's run)
E:\Learnings\YeoMan Code Generator\YeoManClassLibrary>cd MyClassLibrary
E:\Learnings\YeoMan Code Generator\YeoManClassLibrary\MyClassLibrary>dotnet restore
Restoring packages for E:\Learnings\YeoMan Code Generator\YeoManClassLibrary\MyClassLibrary\MyClassLibrary.csproj...
Generating MSBuild file E:\Learnings\YeoMan Code Generator\YeoManClassLibrary\MyClassLibrary\obj\MyClassLibrary.csproj.nuget.g.props.
Generating MSBuild file E:\Learnings\YeoMan Code Generator\YeoManClassLibrary\MyClassLibrary\obj\MyClassLibrary.csproj.nuget.g.targets.
Restore completed in 14.57 sec for E:\Learnings\YeoMan Code Generator\YeoManClassLibrary\MyClassLibrary\MyClassLibrary.csproj.
До здесь всеработает нормально.
Но когда я пытаюсь создать класс из этой ссылки , он выдает ошибку, как показано ниже:
E:\Learnings\YeoMan Code Generator\YeoManClassLibrary\MyClassLibrary>yo aspnet:class Customer
Error aspnet:class Customer
You don't seem to have a generator with the name “aspnet:class” installed.
But help is on the way:
You can see available generators via npm search yeoman-generator or via http://yeoman.io/generators/.
Install them with npm install generator-aspnet:class.
To see all your installed generators run yo without any arguments. Adding the --help option will also show subgenerators.
If yo cannot find the generator, run yo doctor to troubleshoot your system.
Кроме того, яищу ссылку на то, как я могу создать пользовательские шаблоны для .Net , используя YeoMan .