Since Episerver 7.5 you can install Episerver CMS via Nuget. Being able to install Episerver via Nuget makes upgrading a lot simpler compared to previous versions. In the future when you want to upgrade your site, you should be able to do it via the Package Manager. It also means that to add new features
Step One – Set-up Your EPiServer NuGet Feed
For this tutorial, I’ll assume you have Nuget installed. If you don’t, have a quick Google. In Visual Studio click Tools -> Options and navigate to the ‘NuGet Package Manager -> Package Sources’ tab.
Click the ‘+’ icon and at the bottom add in EPiServer as the name and for the package, source uses this URL:
Click ‘Update’ and you’re down. In Nuget you should now see an EPiServer tab in the Online section that allows you to browse a number of EPiServer related functions.
Step Two- Download the new Visual Studio Template
First thing is you need to do is download the EPiServer, the easiest method is to download the Episerver Website Template.
Step Four – Create a new website
In Visual Studio create a new Project, make sure ‘Installed’ is selected and type ‘epi’ into the search field. You should see a project called ‘EPiServer Web Site’ select it.
Select which project type you want, hit ‘Ok’ and sit back. Now I should warn you I have waited around 20 minutes for this process to finish. The ‘Empty’ project obviously will take less time as it has less to install but it will mean you have more work to do. I suggest at this point hitting F5 in Visual studio and make sure the site works OK. Remember if you used the Empty project you should just see a 404 page. If you see a network-related error that’s OK. All the error means is that you still have some database configuring to do.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.
If you are puzzled about the location of the default database, then in Visual Studio if you click on ‘Show All Files’ and have a look in your ‘App_data’ folder and you should see an EPiServer .mdf and .ldf.
In most scenarios, you want to host your Episerver database in SQL server, rather than your websites ‘App_data’ folder. In a production environment, this is definitely considered bad practice. So to fix the issue, move the .mdf and .df out of your App_Dat folder, attach it in SQL and then in your web.config connection string update your connection details accordingly:
<connectionStrings> <add name="EPiServerDB" connectionString="Data Source=###;Initial Catalog=###;User ID=###;Password=###;" providerName="System.Data.SqlClient" /> </connectionStrings>
Step Five- Update the Core packages
As this new project works via Nuget it’s very likely that a few of the packages you may want to use are out-of-date and need upgrading. After I’ve created a new project I always update my Core packages to make sure I’m using the latest versions. Right click on your new website in solution explorer and manage ‘Manage NuGet Packages’.
In Nuget make sure ‘Updates is selected. Click on the EPiServer feed you created in Step One. You will probably now see a list of packages the installer installed that are out of date. If you click the ‘Update All’ button Visual Studio will now update all the files for you.
Now you’ve updated your core packages you may also need to update your database. First thing to do after the core package update is to run the site. If you get a database error then you’ll need to run a simple database update command.
The database has not been updated to the version ‘7007.0’, current database version is ‘7006.0’. Update the database by running the cmdlet ‘update-epidatabase’ in the package manager console.
To fix this simple open the package console:
Type in ‘update-database’ and Nuget should automatically run the required SQL scripts to upgrade your website.
If you have followed the instruction properly you should now have a fully working EPiServer site. I’ve created a few websites using this process now and it does make the process a lot easier, however, from my experience the process is painfully slow, I think it took me over 40 minutes to install a site that I could have done in 10 minutes normally.