Skip to content

Getting started with Orchard Core as a NuGet package

开始使用Orchard Core作为NuGet包

In this article, we are going to see how easy it is to create a CMS Web application using the NuGet packages provided by Orchard Core.

在本文中,我们将看到使用Orchard Core提供的NuGet包创建CMS Web应用程序是多么容易。

You can find the original blog post written by Chris Payne here:

你可以在这里找到由Chris Payne撰写的原创博文:

http://ideliverable.com/blog/getting-started-with-orchard-core-as-a-nuget-package

http://ideliverable.com/blog/getting-started-with-orchard-core-as-a-nuget-package

Create an Orchard Core CMS application

创建Orchard Core CMS应用程序

In Visual Studio, create a new empty .NET Core web application. Ex: Cms.Web.

在Visual Studio中,创建一个新的空.NET Core Web应用程序。例如:Cms.Web

If you want to use the dev packages, add this OrchardCore-preview MyGet url to your NuGet sources:

如果你想使用dev包,请将这个OrchardCore-preview MyGet url添加到你的NuGet源:

https://www.myget.org/F/orchardcore-preview/api/v3/index.json

https://www.myget.org/F/orchardcore-preview/api/v3/index.json

Right-click on the project and click on Manage NuGet packages....

右键单击该项目,然后单击“Manage NuGet packages ...”。

In the Browse tab, search for OrchardCore.Application.Cms.Targets and Install the package.

Browse选项卡中,搜索OrchardCore.Application.Cms.TargetsInstall包。

Open Startup.cs and modify the ConfigureServices method by adding this line:

打开Startup.cs并通过添加以下行来修改ConfigureServices方法:


services.AddOrchardCms();

 <font color=#0099ff size=4 face="黑体">services.AddOrchardCms();</font> 


In the Configure method, replace this block:

Configure方法中,替换此块:


app.Run(async (context) =>

 <font color=#0099ff size=4 face="黑体">app.Run(async(context)=></font> 


{

 <font color=#0099ff size=4 face="黑体">{</font> 


    await context.Response.WriteAsync("Hello World!");

});

 <font color=#0099ff size=4 face="黑体">});</font> 


with this line:

用这一行:


app.UseOrchardCore();

 <font color=#0099ff size=4 face="黑体">app.UseOrchardCore();</font> 


Setup your application

设置您的应用程序

Launch your application (Ctrl+F5). The setup page is displayed.

启动您的应用程序(Ctrl + F5)。显示设置页面。

Enter the required information about the site:

输入有关网站的必要信息:

  • The name of the site. Ex: Orchard Core.

  • 网站的名称。例如:Orchard Core

  • The theme recipe to use. Ex: Agency.

  • 要使用的主题配方。例如:代理商

  • The timezone of the site. Ex: (+01:00) Europe/Paris.

  • 网站的时区。例如:(+01:00)欧洲/巴黎

  • The Sql provider to use. Ex: SqLite.

  • 要使用的Sql提供程序。例如:SqLite

  • The name of the admin user. Ex: admin.

  • 管理员用户的名称。例如:admin

  • The email of the admin. Ex: foo@bar.com

  • 管理员的电子邮件。例如:foo @ bar.com

  • The password and the password confirmation.

  • 密码和密码确认。

Submit the form and your site is generated after a few seconds.

提交表单,几秒钟后生成您的网站。

Then, you can access to the admin using the /admin url. Enjoy.

然后,您可以使用/ admin网址访问管理员。请享用。