Ecommerce Blog Filters
Picture for blog post How to upgrade plugin to 4.80.0

How to upgrade plugin to 4.80.0

Created on:  25.09.2020

In this article, you will learn how to make an upgrade of each plugin to the newest version of GrandNode - 4.80.0.

What will you need? Just VisualStudio 2019, with GrandNode source version of 4.80.0 and source code of the plugin, which you want to upgrade. Please remember that all of our plugins can be purchased with source code as an option. It gives you the possibility to personalize every plugin.

1. First step for less work

Copy your plugin source code to the main Plugin folder in the solution, just like the default plugins at GitHub repository (click here to check). Now, it's time to open a Visual Studio and add a plugin to the project. To perform that, just right mouse click at the Plugins folder and choose Add -> Existing project, shown like on the image below. 

Add plugin to solution

You will see a new window, where you need to provide the physical path to the plugin. When you will be inside the plugins folder, select the *.csproj file. 

add plugin explorer

As a result, you will see the new plugin listed in the Plugins project, as it's shown on the screenshot below:

Added plugin to solution

2. Add necessary reference and new file 

With the 4.80.0 version comes a new file (Manifest.cs), it's a replacement for the Description.txt file, which was removed from each plugin. Just open one of the default plugins, and copy the Manifest.cs file to your plugin. Now modify Manifest.cs, so it will provide information about your plugin. Just like I have done at the below image. 

manifest

When it is ready, click the Save button, and delete Description.txt. 

Another important thing which has to be changed - add a new reference. Because we created a new project, you need to point it in your plugin. The Grand.Domain is a new project, which has files from the Grand.Core. 

new refference

Below it's a ready-to-use code, which you can copy and paste into the plugin. 

<ProjectReference Include="..\..\Grand.Domain\Grand.Domain.csproj">
<Private>false</Private>
</ProjectReference>

3. Quick searching code for errors

The easiest way to find all errors at the plugin would be to rebuild the solution. Just click the right mouse button at your plugins name, and choose Rebuild. 

rebuild plugin

The result will list all issues, which prevent the plugin from rebuilding.

list of errors

If you click at the error message, you will be moved to the file and line where the issue is visible. Most of the changes at the code are related to new reference and replaced name - BaseGrandModel to BaseModel. BaseModel was moved to Grand.Core from Grand.Framework, this same with ModelBinding. 

some fixes

The easiest way, just use Visual Studio hints. 

more fixes

4. Views need to check manually

Some changes need to be checked manually, that is for all views files. Change that was made at the newest version of the GrandNode was related to loading CSS files. Just if you have missed that, previously was used form. 

Html.AppendCssFileParts($"~/Plugins/Widgets.SpecialOffer/Content/css/style.css");

You need to replace that line with page builder, and need to add also @inject

@inject IPageHeadBuilder pagebuilder
@{
    pagebuilder.AppendCssFileParts(ResourceLocation.Head, string.Format("~/Plugins/Widgets.SpecialOffer/Content/css/style.css"));
}

If your plugin had used command

Html.SetActiveMenuItemSystemName("YOURNAME");

At a new 4.80.0 you need to replace it by

<input id="active-menu-item" type="hidden" value="/Admin/CONTROLLER/ACTION" />

Your plugin should be ready. Do not forget to test the plugin before production use. 

back to top
Filters