Plugin using external dll fails

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 anos atrás
Hi all

I am developing a plugin for version 4.50.

This plugin is using a custom library (AO.Services) i have put under the Libraries Folder in Nop.
AO.Services is using NLog for some logging, and NLog is added as a nuget package to AO.Services.
Version 4.7.13 (latest)

Whenever I run the plugin and hit the code doing the logging I get this error:

Could not load file or assembly 'NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c'. The system cannot find the file specified.


What I am doing wrong, why is this dll not part of the build and get copied?

Best regards,
Axel
2 anos atrás
AxelAndersen wrote:

What I am doing wrong, why is this dll not part of the build and get copied?


Is the nlog dll visible in the solution/project? Is the properties of the nlog dll 'copy if newer' during the build. You might want to check...

alternatively, could you add in build events to copy the file over to the output.
2 anos atrás
Please check the properties of external dll. You may follow default nopCommerce plugin Nop.Plugin.Misc.Sendinblue, how it added RestSharp.dll
2 anos atrás
I see that the SendInBlue plugin is using RestSharp.dll by having the dll directly put in the project and then do this in the project file:

<None Update="RestSharp.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>


But is there no way to use Nuget packages with NopCommerce?
2 anos atrás
I thought you have added a external dll, Nuget packages should work automatically.
Just check if your plugin csproj file contains something like this
<ItemGroup>
    <PackageReference Include="NLog" Version="4.0.0.0" />
  </ItemGroup>
2 anos atrás
After adding NLog as nuget package, this is what is in the project file:

<PackageReference Include="NLog" Version="4.7.13" />


But no NLog.dll found anywhere after build.
2 anos atrás
Note that the SendInBlue csproj explicitly references the external DLLs

  <ItemGroup>
    <None Update="RestSharp.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="SendinblueMarketingAutomation.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
2 anos atrás
Hi

Yes, I have seen that they explicitly references the external DLLs, but why is that necessary?
Why isn't it enough to reference a Nuget Package?
2 anos atrás
Actually it seems to only be a problem when installing the plugin on a separat server.
Running it from Visual Studio, it works.

When installing i first make the plugin output directory to a zip file and install that.
Is there any addtional steps I should perform?
2 anos atrás
AxelAndersen wrote:

Yes, I have seen that they explicitly references the external DLLs, but why is that necessary?
Why isn't it enough to reference a Nuget Package?

You can check this link https://stackoverflow.com/questions/68572832/build-project-without-runtimes-folder-but-included-nuget-packages-in-nopcommerce
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.