打包和共享模块-Packaging and Sharing a Module

After developing a module extension to Orchard, you probably want to share it with others. Orchard provides a module packaging feature that can be used to create a package file containing your module. To enable this feature, visit the "Features" section of the Orchard admin panel and enable the "Orchard.Packaging" feature.

在为Orchard开发模块扩展后,您可能希望与其他人共享。 Orchard提供了一个模块打包功能,可用于创建包含模块的包文件。要启用此功能,请访问Orchard管理面板的“功能”部分,并启用“Orchard.Packaging”功能。

Alternatively, you can enable the Orchard.Packaging feature from the Orchard command-line. To do this, run bin\orchard.exe from the root of your Orchard installation, or the root of the Orchard.Web project if you are running against a source enlistment.

或者,您可以从Orchard命令行启用Orchard.Packaging功能。要执行此操作,请从Orchard安装的根目录运行bin \ orchard.exe,或者如果您针对[source enlistment](设置源代码登记)运行,则运行Orchard.Web项目的根目录。

orchard> feature enable Orchard.Packaging

When the Orchard.Packaging feature is enabled, the Orchard command-line tool supports additional commands that can be used to create a package (.nupkg file) from any module in your Orchard installation, and to install a new module from a packaged .nupkg file.

启用Orchard.Packaging功能后,Orchard命令行工具支持可用于从Orchard安装中的任何模块创建包([.nupkg文件](http://nuget.org))的其他命令,并从打包的.nupkg文件安装新模块。

package create <extensionName> <path>

    Create a package for the extension <extensionName>

    (an extension being a module or a theme).

    The package will be output at the <path> specified.

    The default filename is Orchard.[Module|Theme].<extensionName>.<extensionVersion>.nupkg.

    For example, "package create SampleModule c:\temp" will create the package

    "c:\temp\Orchard.Module.SampleModule.1.0.0.nupkg".



package install <packageId> <location> /Version:<version>

        Install a module or a theme from a package file.



package uninstall <packageId>

    Uninstall a module or a theme.

    The <packageId> should take the format Orchard.[Module|Theme].<extensionName>.

    For example, "package uninstall Orchard.Module.SampleModule" will uninstall the Module under the "~/Modules/SampleModule" directory and

    "package uninstall Orchard.Theme.SampleTheme" will uninstall the Theme under the "~/Themes/SampleTheme" directory.



user create /UserName:<username> /Password:<password> /Email:<email>

        Creates a new User

By running the "package create" command, you can create a zip file of a module.

通过运行“package create”命令,您可以创建模块的zip文件。

orchard> package create Lucene C:\Temp

Package "C:\Temp\Orchard.Module.Lucene.1.0.0.nupkg" successfully created

Orchard uses the NuGet packaging format to create module packages (basically .zip files with extra metadata information about your package). NuGet is based on the OPC packaging format, which you can learn more about at http://en.wikipedia.org/wiki/Open_Packaging_Conventions.

Orchard使用[NuGet](http://nuget.org)打包格式来创建模块包(基本上是.zip文件,包含有关包的额外元数据信息)。 NuGet基于OPC包装格式,您可以在[http://en.wikipedia.org/wiki/Open_Packaging_Conventions](http://en.wikipedia.org/wiki/Open_Packaging_Conventions)了解更多信息。

Once you've created a module package, you can share it easily with others. Orchard provides the ability to browse and install a module from the "Modules" section of the Orchard admin panel. Refer to the Installing and upgrading modules topic for more details.

创建模块包后,您可以轻松地与其他人共享。 Orchard提供了从Orchard管理面板的“模块”部分浏览和安装模块的功能。有关更多详细信息,请参阅[安装和升级模块](安装和升级模块)主题。

Additionally, Orchard provides a Gallery feature that can register one or more gallery feeds of module extensions (OData format). Users can easily install modules from any registered feed. A default gallery feed is exposed from this website, at https://gallery.orchardproject.net/api/FeedService. For more information, refer to the Module gallery feeds topic.

此外,Orchard提供了Gallery功能,可以注册一个或多个模块扩展的图库供稿(OData格式)。用户可以从任何已注册的Feed轻松安装模块。此网站公布了默认的图库供稿,网址为[https://gallery.orchardproject.net/api/FeedService](https://gallery.orchardproject.net/api/FeedService)。有关更多信息,请参阅[模块库供稿](模块库供稿)主题。

You can visit the Gallery admin panel menu to browse and install available modules and themes online. The http://gallery.orchardproject.net/ website provides a browsable front-end for finding and downloading available modules and themes too.

您可以访问“图库管理”面板菜单,在线浏览和安装可用的模块和主题。 [http://gallery.orchardproject.net/](http://gallery.orchardproject.net/)网站提供了可浏览的前端,用于查找和下载可用的模块和主题。

You can easily upload your custom module package to our Galllery website to share it with other Orchard users. Register an account and contribute your module here.

您可以轻松地将自定义模块包上传到我们的Galllery网站,以便与其他Orchard用户共享。 [注册帐户](https://gallery.orchardproject.net/Users/Account/Register)和[在此贡献您的模块](https://gallery.orchardproject.net/Contribute/Index)。