Upgrading a NopCommerce Plugin from 3.80 To 4.00
When upgrading nopCommerce, you’ll need to also get the latest versions of plugins to go alongside the nopCommerce installation. Depending on the upgrade, you may need to make some minor changes to the plugin to get it working.
In particular, 3.80 -> 4.00 marks the transition to .NET Core, meaning there are some significant changes to make.
Upgrade the .csproj File
To start, you’ll want to upgrade the .csproj
file of the project. Easiest option here is to copy an existing plugin that works with nopCommerce 4.00 and modify it accordingly. You can use the Description.txt
file to get the information you need.
File Cleanup
First, create a plugin.json
file.
Delete the following files:
- web.config
- app.config
- Description.txt
- Properties folder
Fix Build
Once you’ve done this, you’ll need to go through the file and make any kind of modifications to get a build to work successfully. If you’re working with VSCode, add the following file omnisharp.json
to the plugin:
There are a few specifics to consider:
- When migrating
GetConfigurationRoute
, the route will be moved into aInfrastructure/RouteProvider.cs
file (as an example). BasePublicController
becomesBasePluginController
.AdminAuthorize
becomesAuthorizeAdmin
.- Remove references to
ChildActionOnly
.
Validate Functionality
After getting the build to work successfully, the final step is running nopCommerce locally and installing/uninstalling the plugin. In addition, check the functionality to make sure everything is working.
Reminder: when installing/uninstalling plugins in nopCommerce locally, make sure to shut down and restart the application after installing applications to reflect plugin installation changes.