我们有一个控制台应用程序,用于管理 WSS 3.0 站点。该应用程序使用 Microsoft.SharePoint 程序集,它在 WSS 3.0 中的版本为 12.0.0.0
现在,我们希望在 SharePoint 2013 上使用相同的控制台应用程序,而无需为该特定版本重新构建新的控制台应用程序。由于 SharePoint 2013 附带版本 15.0.0.0 的 Microsoft.SharePoint 程序集,因此我创建了一个包含以下内容的应用程序配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.SharePoint"
publicKeyToken="71e9bce111e9429c"
culture="neutral"
/>
<!-- Redirecting to version 15.0.0.0 of the assembly. -->
<bindingRedirect oldVersion="12.0.0.0"
newVersion="15.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
但是它不起作用,绑定失败。任何想法为什么?
我在绑定日志中看到以下内容:
** Assembly Binder Log Entry (2013-07-15 @ 11:28:53) **
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable C:\Users\fredrikg\Desktop\Customer\Bin\UseMicrosoftSharePoint.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = INFOWEAVER\fredrikg
LOG: DisplayName = Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
(Fully-specified)
LOG: Appbase = file:///C:/Users/fredrikg/Desktop/Customer/Bin/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : UseMicrosoftSharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\fredrikg\Desktop\Customer\Bin\UseMicrosoftSharePoint.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Redirect found in application configuration file: 12.0.0.0 redirected to 15.0.0.0.
LOG: Post-policy reference: Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Users/fredrikg/Desktop/Customer/Bin/Microsoft.SharePoint.DLL.
LOG: Attempting download of new URL file:///C:/Users/fredrikg/Desktop/Customer/Bin/Microsoft.SharePoint/Microsoft.SharePoint.DLL.
LOG: Attempting download of new URL file:///C:/Users/fredrikg/Desktop/Customer/Bin/Microsoft.SharePoint.EXE.
LOG: Attempting download of new URL file:///C:/Users/fredrikg/Desktop/Customer/Bin/Microsoft.SharePoint/Microsoft.SharePoint.EXE.
LOG: All probing URLs attempted and failed.
LOG: Attempting to install assembly using Windows Installer.
LOG: GAC Lookup was unsuccessful.