错误无法加载文件或程序集'Nlog,version = 4.0.0.0,culture = neutral,publickeytoken = 5120e14c030593c'

时间:2017-06-08 12:59:45

标签: sharepoint-2013

我有一个2个Sharepoint项目Sharepoint-Svr-App& Sharepoint-svr-Job在一个解决方案中,两个项目都有NLog参考。发布这两个项目会生成相应的* .wsp文件而不会出现任何问题。部署解决方案时,Sharepoint-svr-App的部署没有任何问题,但Sharepoint-Svr-Job失败并出现错误:

Could not load file or assembly 'Nlog, version=4.0.0.0, culture=neutral, publickeytoken=5120e14c030593c'

请查看随附的屏幕截图here

Sharepoint-Srv-App.csproj中的条目如下:

<ItemGroup>
    <Reference Include="NLog">
      <HintPath>packages\NLog.4.4.5\lib\net45\NLog.dll</HintPath>
    </Reference>
    <Reference Include="NLog.Web">
      <HintPath>packages\NLog.Web.4.4.0\lib\net35\NLog.Web.dll</HintPath>
    </Reference>    
<ItemGroup>      

和Sharepoint-Srv-Job.csproj看起来像

<ItemGroup>      
    <Reference Include="NLog">      
      <HintPath>..\Sharepoint-Svr-App\packages\NLog.4.4.5\lib\net45\NLog.dll</HintPath>
    </Reference>
    <Reference Include="NLog.Web">
      <HintPath>..\Sharepoint-Svr-App\packages\NLog.Web.4.4.0\lib\net35\NLog.Web.dll</HintPath>
    </Reference>
<ItemGroup>  

两个项目中的packages.config文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="NLog" version="4.4.5" targetFramework="net45" />
  <package id="NLog.Config" version="4.4.5" targetFramework="net45" />
  <package id="NLog.Schema" version="4.4.5" targetFramework="net45" />
  <package id="NLog.Web" version="4.4.0" targetFramework="net45" />
</packages>

1 个答案:

答案 0 :(得分:0)

问题得到解决

尝试将外部dll添加到解决方案中并进行检查。

转到Package.package-&gt; Advanced。

这是一个供您参考的帖子。

https://social.technet.microsoft.com/Forums/office/en-US/7642b88a-4046-4429-a9d2-e2088c86f3fd/deploying-custom-dlls-in-sharepoint-2013?forum=sharepointadmin