我有一个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>
答案 0 :(得分:0)
问题得到解决
尝试将外部dll添加到解决方案中并进行检查。
转到Package.package-&gt; Advanced。
这是一个供您参考的帖子。