Skip to content

This topic is being updated for the Orchard 1.1 release.

本主题正在针对Orchard 1.1版本进行更新。

Orchard provides a packaging feature that lets you share themes you have created. The feature creates a package (.zip file, in .nupkg format) that contains your theme. It also lets you upload your new theme to the Orchard Gallery.

Orchard提供了一个包装功能,可让您分享您创建的主题。该功能创建一个包含主题的包(_.zip_文件,[。nupkg](http://nuget.org)格式)。它还允许您将新主题上传到Orchard Gallery。

This article shows you how to package a theme and upload it the Orchard Gallery, and how users can download and install your theme.

本文向您介绍如何打包主题并将其上传到Orchard Gallery,以及用户如何下载和安装主题。

Viewing the Packaging Modules

查看包装模块

To view the packaging modules, open the Orchard dashboard and click Modules. Scroll to Packaging.

要查看打包模块,请打开Orchard仪表板,然后单击 Modules 。滚动到包装

The Packaging modules are enabled by default. If any of the modules have been disabled, you must enable them in order to package and upload your theme.

Packaging 模块默认启用。如果已禁用任何模块,则必须启用它们才能打包和上载主题。

Packaging Your Theme

打包你的主题

To package your theme, open the Orchard command line and type the following command, replacing MyFirstTheme with the name of your theme, and C:\Temp with the output path for the generated package file.

要打包主题,请打开 Orchard命令行并键入以下命令,将_MyFirstTheme_替换为主题名称,然后选择_C :\ Temp_包含生成的包文件的输出路径。

package create MyFirstTheme C:\Temp

The package feature creates a .nupkg file. (For more information, see NuGet.org.) The name of the .nupkg file is the name of your theme plus its version number, as in the following example:

包功能会创建_.nupkg_文件。 (有关更多信息,请参阅[NuGet.org](http://nuget.org)。)_. nupkg_文件的名称是主题的名称及其版本号,如下例所示:

Orchard.Theme.<nameOfYourTheme>.<version>.nupkg

Uploading Your Theme to Gallery

将主题上传到图库

After creating your package, you can share your theme by giving someone the package file. You can also contribute your theme to the Orchard Gallery. For information about how to contribute your theme, see Contributing a Module or Theme to the Gallery.

创建包后,您可以通过向某人​​提供包文件来共享您的主题。您还可以将您的主题贡献给Orchard Gallery。有关如何贡献主题的信息,请参阅[将模块或主题贡献到库中](将模块或主题贡献到库中)。

Installing a Packaged Theme

安装打包的主题

To install a packaged theme in Orchard, open the Orchard dashboard. Click Themes, and then click Install a theme from my compter.

要在Orchard中安装打包的主题,请打开Orchard仪表板。单击主题,然后单击从我的计算机安装主题。

Click Choose File. Browse to, and select, the theme package (.nupkg) file, and then click Open. Then click Install. If Orchard is running on a remote server, you will be browsing your local computer; you do not need to put the .nupkg file onto the server before installing.

单击选择文件。浏览并选择主题包(.nupkg)文件,然后单击打开。然后单击安装。如果Orchard在远程服务器上运行,您将浏览本地计算机;在安装之前,您不需要将_.nupkg_文件放到服务器上。

Your new theme appears under Available.

您的新主题显示在 Available 下。