DiscountRequirement.MustBeAssignedToCustomerRole system name is already defined

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

i just downloaded nopcommerce v4.20 source code when i open it with visual studio 2019 and press f5 to run it i get error DiscountRequirement.MustBeAssignedToCustomerRole system name is already defined i didn't changed any thing , i can't find why i get this error message .
4 years ago
Lot of topics are already available on forum. Check here

https://www.nopcommerce.com/boards/t/29392/a-plugin-with-pluginname-system-name-is-already-defined.aspx
https://www.nopcommerce.com/boards/t/49990/nopcommerce-40-exception-a-plugin-with-noppluginmiscpluginname-system-name-is-already-defined.aspx
https://www.nopcommerce.com/boards/t/19506/a-plugin-with-paymentsmanual-system-name-is-already-defined.aspx
4 years ago
Same for me, downloaded a fresh install of v4.20 and can not run the project.
I get the same error exception: 'A plugin with 'DiscountRequirement.MustBeAssignedToCustomerRole' system name is already defined.
4 years ago
It’s a very common questions of Nop community. Check all built plugin folders one by one (Nop.Web > Plugins) and check if there are multiple plugin.js files with DiscountRequirement.MustBeAssignedToCustomerRole system name.
4 years ago
I've looked for duplicates, checked every plugin.json file, checked the <output> location, inserted the code block on github, deleted teh plugins and rebuilt, all to no avail. I am dead in the water too. Seems like the true root cause has not yet been found and some random workarounds that may or may not work in every case have been asserted so far. I'm getting pretty frustrated with this error as my productivity has come to a halt.
4 years ago
Are you getting the error in Visual Studi or in you production website ?
I found one of the plugin directories will have /plugin directory inside both development and production
You need to update the Nop.Web build file with code
I replaced
  <ItemGroup>
    <Folder Include="Plugins\" />
  </ItemGroup>
with
  <ItemGroup>
    <!-- This setting fixes the problem caused by this update in the websdk in vs2019
    https://github.com/aspnet/websdk/commit/7e6b193ddcf1eec5c0a88a9748c626775555273e#diff-edf5a48ed0d4aa5a4289cb857bf46a04
    Therefore, we restore the standard configuration behavior (there was no copy to the output directory)
    in order to avoid the "Duplicate dll" error during publication.
    We can also use “ExcludeConfigFilesFromBuildOutput” according to https://github.com/aspnet/AspNetCore/issues/14017 -->
    <Content Update="**\*.config;**\*.json" CopyToOutputDirectory="Never" CopyToPublishDirectory="PreserveNewest" />
  </ItemGroup>

Clean the project and rebuild
Then check the website runs in Visual Stuido
Then in production stop the webserver app pool and website
Then delete all the plugins in directory and in Plugins/bin directory
And copy all the plugins from development to production server
Start  the webserver app pool and website
See if that worked
4 years ago
This is occurring in Visual Studio. I did finally find additional plugins folders in several of the other plugins in the Nop.Web Plugins folder structure (once I rebooted my computer).

However, now when I go into Admin > Configuration > Local Plugins, and click the button "Reload list of plugins", the browser session crashes and closes, putting me back in VS.
4 years ago
Yes that’s how it works in VS just run it again. A few of the functions need you to restart again to finish the process
4 years ago
Thanks, Yidna. You've been a big help!
4 years ago
To solve the problem go to the Nop.Web the in the plugins folder delete all the plugins and do a clean solution then build the Plugin one after the other.

That worked for me
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.