Upgrade from 3.9 to 4.6 on VS 2022 targets 'net7.0' cannot be referenced by a project that targets .NETFramework,Version=v4.5.1

4 months ago
Hi
I am upgrading Nop 3.9 to Version 4.6, when I load my project on Visual Studio 2022, and rebuild, it throws error of Project Framework Targets errors.  

Severity  Code  Description  Project  File  Line  Suppression State
Error    Project '..\..\Presentation\Nop.Web.Framework\Nop.Web.Framework.csproj' targets 'net7.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.5.1'.  Nop.Plugin.Api      
Severity  Code  Description  Project  File  Line  Suppression State
Error    Project '..\..\Libraries\Nop.Data\Nop.Data.csproj' targets 'net7.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.5.1'.  Nop.Plugin.Api      

Severity  Code  Description  Project  File  Line  Suppression State
Error    Project '..\..\Libraries\Nop.Services\Nop.Services.csproj' targets 'net7.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.5.1'.  Nop.Plugin.Api      

Severity  Code  Description  Project  File  Line  Suppression State
Error    Project '..\..\Libraries\Nop.Core\Nop.Core.csproj' targets 'net7.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.5.1'.  Nop.Plugin.Api      



I have followed the suggested requirements by the NOP group and all requirements are fulfilled by the link be link below.


https://docs.nopcommerce.com/en/installation-and-upgrading/technology-and-system-requirements.html
Any advise would be much appreciated


https://i.postimg.cc/nzjmFyfW/Screenshot-target-error.png
Thanks
4 months ago
Did you edit and upgrade the Project file for every project in the solution ?
Do you have any no-standard dependencies that are targeting .NETFramework,Version=v4.5.1
4 months ago
Yidna wrote:
Did you edit and upgrade the Project file for every project in the solution ?
Do you have any no-standard dependencies that are targeting .NETFramework,Version=v4.5.1


Hi Yidna,
Thanks for your response, much appreciated.
1. I have edited all projects files version section from 4.5 to 7.0 below

    <TargetFramework>net7.0</TargetFramework>
    <Version>4.5.0.0</Version>

to

<PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <Version>7.0.0.0</Version>


2. edited and updated nop.plugin.api project file below


    <AssemblyName>Nop.Plugin.Api</AssemblyName>
    <TargetFrameworkVersion>v7.0.0</TargetFrameworkVersion>


but still the same error


    Severity  Code  Description  Project  File  Line  Suppression State
Error    Project '..\..\Libraries\Nop.Core\Nop.Core.csproj' targets 'net7.0'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.5.1'.  Nop.Plugin.Api      

4 months ago
According to your error the "Nop.Plugin.Api" project still references '.NETFramework,Version=v4.5.1'. It should be upgraded to .NET 7

Looks like it's a third-party project. I would also recommend contacting its developers to provide a working version of this plugin for nopCommerce 4.60
4 months ago
a.m. wrote:
According to your error the "Nop.Plugin.Api" project still references '.NETFramework,Version=v4.5.1'. It should be upgraded to .NET 7

Looks like it's a third-party project. I would also recommend contacting its developers to provide a working version of this plugin for nopCommerce 4.60

Hi A.M
Many thanks for your response, and yes this is a custom plugin, and developed and working in the NOP V3.9, I am looking into this as a developer and upgrading it into NOP V4.6 ,
what would be the best way to make this plugin upgrade in V4.6, create a new plugin, and push all the code manually in the new V4.6?
or change the target reference version?

many thanks for your response.

4 months ago
You can not just change the version in the config file

Do you have the source code for the Plugin ?
Otherwise you will need create the plugin from scratch or contact the developer to upgrade

Or what does the Api plugin do - maybe use the nopCommerce Api plugin
4 months ago
Yidna wrote:
You can not just change the version in the config file

Do you have the source code for the Plugin ?
Otherwise you will need create the plugin from scratch or contact the developer to upgrade

Or what does the Api plugin do - maybe use the nopCommerce Api plugin

Hi Yidna
Thanks again for your response, much appreciated, Yes I have got the source code of the all custom plugin.

Api plugin is the API data-sharing communication between the NOP and CRM
in that case, what would be the best approach for a custom plugin upgrade, please?

Many thanks and much appreciated for your help

4 months ago
prabirchoudhury wrote:
... what would be the best approach for a custom plugin upgrade...

There are many changes from 3.90 to 4.60, most notably async.  I recommend you make a copy of the built-in \Plugins\Nop.Plugin.Misc.WebApi.Frontend.  First, copy it into a temp folder, delete obj and bin folders if any, and then using an editor like notepad++, find/replace "Frontend" with your custom name (match case) in all files (including .csproj).   Then, copy the temp folder to your solution \Plugins folder.  Then, in Visual Studio, solution explorer, right-click Plugins folder, then Add  > Existing project , and select the .csproj file.
You can then build the project it to be sure it's OK before you start copying over your code and refactoring.