How to convert plugin class library project from nop 3.90 to nop 4.0

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hi,

This is more of a .NET Core question, than nopCommerce... but here goes:

I was wondering how would one convert a class library (plugin) project from nop 3.90 to nop 4.0... I saw that in nopCommerce 4.0 Solution, the old plugins (for example Nop.Plugin.Payments.CheckMoneyOrder) are still targeting .NET Framework 4.6.1, so I suppose they were not re-created as .NET Core class libraries, but somehow converted - they "look" as .NET Core class libraries meaning they are missing the web.config file, the packages.config file... the "References" node is missing, and instead we now have the "Dependencies" node.

But when I add a plugin from a nop 3.90 solution, to the new .NET Core solution,  I still have the web.config and packages config, of course, as well as the References node... so not sure how to do that conversion.

Any tips ?


Regards,
Vlad
6 years ago
Hi Valad,

Yes, they have converted an old .csproj file to the core file.
Even if you add new core class library its targeted to NET Framework 4.6.1. You can get more info from here:



Now comes to update plugin from older version to compatible with 4.0.
For that, You need to change plugin's .csproj file.

There are lot of changes to do, such as remove web.config and remove all ref. and give ref. of Nop.Web.Framework.csproj file only and so on... And the new .csproj files basic Structure looks like::

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>
</Project>


Here is good read: Old csproj to new csproj: Visual Studio 2017 upgrade guide

You can follow any default plugin project file as ref. Once you done! assembly errors will be waiting for you :)

Hope this helps you!
6 years ago
We'll prepare and publish a complete tutoral on site and plugin upgrades (from 3.90 to 4.00) soon. Now it's still being prepared
6 years ago
Any update on that tutorial ? Thanks !
6 years ago
Is that tutorial ready?
6 years ago
armanforghani wrote:
Is that tutorial ready?


I have done the following way ==>Hope it will help you.

Upgrade plugin

Remove file

1.Remove app.config file
2.Remove web.config file
3.Remove packages.config file
4.Remove .csproj.user file if any
5.Remove properties folder with files
Create File

1.Create Plugin.json file by replacing Description.txt file
2.Modify the .csproj file as other 4.00 plugin’s (Most Important task)
3.Create _ViewImpotrs.cshtml file must be in Views folder
4.Create Competent (new addition in 4.00)  see existing 4.00 plugin how it work
5.Do others necessary step as like others 4.00 plugin’s

Upgrade theme:

1. Create theme.json file with replacing theme config file (Must have to add SystemName for theme . Theme is detected by this SystemName )
2. Remove web.config
3. Remove packages.config
4. Create _ViewImpotrs.cshtml file must be in Views folder
5. Have to modify others staffs as like default clean theme
Widget and child action is now doing by Component  like below
  
 @await Html.PartialAsync("Head")
    @await Component.InvokeAsync("Widget", new { widgetZone = "head_html_tag" })
   @await Component.InvokeAsync("Favicon")


  And declare razor  object init by
 @inject CommonSettings commonSettings 

no need EngineContext


Note: I have made this tips by thumb rule.  You may get more good approach.
5 years ago
Is that tutorial ready?
We are already using lots of plugin and some of the plugin provider are not ready to update on 4.0. if you provide tutorial then we can do it our self.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.