简体   繁体   中英

4.10 PlugIn With NuGet Package Reference Does Not Deploy Correctly

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM