This subject shows how to create a new site running Lynicon ASP.Net Core in Visual Studio 2015.
Create Solution
Lynicon ASP.Net Core currently runs only on the full .Net framework. An ASP.Net Core on .Net Core version will be developed in the near future.
To set up an ASP.Net Core website on full .Net, do the following:
Select ASP.Net Core Web Application (.Net Framework) as the project type.
Do not call the new Solution or Project 'Lynicon' (or Lynicon.Base or any other such name) as it will cause assembly linking problems
Choose the Web Applicatin template. Ensure the Authentication choice is No Authentication as this package sets up its own ASP.Net Identity based membership system.
Install Lynicon
Before installing Lynicon, you should ensure certain dependencies in your project are sufficiently up to date not to clash with Lynicon's dependencies.
Edit the project.json file if necessary to ensure Microsoft.AspNetCore.Mvc is at least version 1.1.1, Microsoft.AspNetCore.Routing is at least 1.1.0, and Microsoft.Extensions.Logging is at least 1.1.0. When you save this file, Visual Studio will automatically restore packages.
Now install Lynicon. Find it in the Nuget Gallery on nuget.org
Choose the LyniconANC package.
Set up Lynicon commands
Now add a line of code that will enable you to use the executable which normally runs the Kestrel webserver with your site to run Lynicon service and setup commands:
Add the highlighted line of code above into your Program.cs file in the root of your project.
Build the Site
Now build the site so that you can use the output executable to run setup commands.
Run Command to Initialize Project
Find the folder in which the output executable from the build is found e.g. something like C:\Dev\MyProject\src\MyProject\bin\Debug\net452\win7-x64.
Open a command window as Administrator (right click the menu item and choose Run as Administrator).
Move (cd) to this directory, and run the command <project name>.exe lynicon initialize-project e.g. as underlined above. This tells your project executable to run a command to download new files and update existing ones in your project. This command makes a number of changes to the Startup.cs file. This will work with the Startup.cs file provided with the template we have used to create this project in these instructions. It should work with most customised Startup.cs files, especially if you follow standard C# formatting, but it is not guaranteed to work. If you have problems, refer to the page which describes the changes you need to make to the Startup.cs file.
Leave the command window open after this as you will need it later.
Set the Connection String to the Database
Determine a SQL database locally or remote which will host the content and user data. In appsettings.json, set the value for the connection string in the configuration section which has been created by the initialize-project command:
Build the Site
Run a build on the site to update it with the changes made by the initialize-project command.
Run the Initialize-Database command
Go back to the command window.
Run <project name>.exe lynicon initialize-database. This will connect to the database with the connection string provided and set up the core tables Lynicon requires.
Disregard an error message produced by log4net, it will work without the configuration it needed in ASP.Net MVC which it is requesting be set up.
Run the Initialization-Admin Command
Run <project name>.exe lynicon initialize-admin <admin password>. This sets up the admin user with the supplied password. Lynicon does not create a default admin user to avoid the scenario where this user is left with their default password causing a major security risk.
Confirm the output from this command looks as below:
You are now ready to use Lynicon CMS.
First Run
If you now run the site and log in as the administrator on /lynicon/login you will be able to see the Lynicon pages as described in the User Manual. Lynicon is now ready to be used for CMS functions.
To now set up a basic content-managed model, route and view, consult the Hello World page.
Add Comment