简体   繁体   English

创建自己的Package Manager控制台命令?

[英]Create own Package Manager Console commands?

I'd like to include custom Package Manager Console commands with my NuGet Package. 我想在NuGet软件包中包含自定义的Package Manager控制台命令。 Just like EF-Core is doing recently to generate the context for example. 就像EF-Core最近正在做的那样生成上下文。 How can this be done without having to use the default folder "... Documents\\WindowsPowerShell\\NuGet_profile.ps1"? 如何在不必使用默认文件夹“ ... Documents \\ WindowsPowerShell \\ NuGet_profile.ps1”的情况下完成此操作? I want to generate classes via console so I do not have to develop a Visual Studio extension for it. 我想通过控制台生成类,因此不必为其开发Visual Studio扩展。 Thank you! 谢谢!

You would pack .pds1/.psm1 files into a tools directory inside the NuGet package. 您可以将.pds1 / .psm1文件打包到NuGet包内的tools目录中。 Which are automatically available inside the Package Manager Console (the tools folder will be added to the PATH environment variable). 它们在Package Manager控制台内自动可用( tools文件夹将添加到PATH环境变量中)。

You can download and inspect the Microsoft.EntityFrameworkCore.Tools for reference, since this is the package that provides the Entity Framework Core commands. 您可以下载并检查Microsoft.EntityFrameworkCore.Tools以供参考,因为这是提供Entity Framework Core命令的程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM