4.10 PlugIn With NuGet Package Reference Does Not Deploy Correctly

519 views Asked by At

I have a simple nopCommerce 4.10 plugin which when deployed and loaded cannot locate assemblies referenced via a Nuget package.

Exception: Plugin 'my plugin'. Could not load file or assembly 'IdentityServer4, Version=2.1.1.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

If I copy the nuget package's assembly directly into the project and treat it as content and deploy the assembly is found and loaded however this is hacky and cannot be the way this is supposed to work.

I can see the Nop.Plugin.Payments.Square plugin uses RestSharp however itself does not reference the Nuget package but instead as a copy of the assembly in the root of the plugin directory, just as I did in my workaround.

So the question is - how are nuget packages referenced within a plugin supposed to be deployed and resolved?

1

There are 1 answers

1
Aquila On

My last solution is using CopyLocalLockFileAssemblies in plugin.csproj:

<PropertyGroup>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

it will copy all references, not only NuGet packages, plugin's artifact will be quite big, but it works.

I'm trying to find better way, but no luck yet.