我正在尝试解决一些我遇到问题的程序集重定向,不幸的是它现在似乎没有工作。我检查了所有标准的东西(我实际上是从以前工作过的脚本中生成的)并且无法弄清楚出了什么问题。这些是我的错误:
我目前的设置是:
我不想使用DLL的 bb 版本,因此我的 Tests.csproj 文件设置的app.config包含以下内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CMS.AmazonStorage" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.370"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.AzureStorage" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.370"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Blogs" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.388"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Chat" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.390"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.CKEditor" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.379"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.CMSHelper" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.374"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.CMSSiteMapProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.375"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.CMSStorage" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Community" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.388"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Controls" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.381"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Controls.XmlSerializers" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.381"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.DatabaseHelper" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.368"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.DataCom" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.394"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.DataEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.DataProviderSQL" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.DocumentEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.372"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Ecommerce" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.390"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.EcommerceProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.393"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.EmailEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.368"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.EventLog" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.EventManager" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.378"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.ExtendedControls" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.377"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.FormControls" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.385"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.FormEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.370"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Forums" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.387"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.GlobalEventHelper" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.GlobalHelper" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.365"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.ImportExport" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.375"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.IO" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.364"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.ISearchEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.363"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.LicenseProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.LicenseProvider.XmlSerializers" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.MediaLibrary" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.387"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.MembershipProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.375"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.MessageBoard" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.387"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Messaging" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.377"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.MetaWeblogProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.395"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Newsletter" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.375"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Notifications" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.388"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.OnlineMarketing" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.392"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.OutputFilter" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.374"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Polls" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.370"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.PortalControls" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.384"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.PortalEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.372"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.ProjectManagement" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.378"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Reporting" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.380"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.ResourceManager" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.364"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SalesForce" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.393"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Scheduler" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.371"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SearchProviderSQL" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SettingsProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.363"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SharePoint" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.378"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SiteProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.369"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.skmMenuControl" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.379"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SocialNetworking" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.388"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.Synchronization" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.367"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.SynchronizationEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.375"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.TranslationServices" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.374"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.UIControls" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.386"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.URLRewritingEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.377"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.VirtualPathHelper" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.366"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.VirtualPathProvider" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.378"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WebAnalytics" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.371"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WebDAV" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.391"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WebFarmSync" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.367"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WebFarmSyncHelper" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.375"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WebServices" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.376"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WinServiceEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.451"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CMS.WorkflowEngine" publicKeyToken="834b12a258f213f9" />
<bindingRedirect oldVersion="7.0.0.0-7.0.65535.65535" newVersion="7.0.4787.371"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Telerik.JustMock" publicKeyToken="721b6c5bc0326b3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2014.1.1317.4" newVersion="2014.1.1317.4" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
我用来生成这些脚本的脚本:
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
var helper = new AssemblyHelper();
helper.GenerateAssemblyRedirects(@"c:\source\test");
public class AssemblyHelper
{
public void GenerateAssemblyRedirects(String path)
{
StringBuilder sb = new StringBuilder();
foreach(String filePath in Directory.GetFiles(path))
{
String file = Path.GetFileNameWithoutExtension(filePath);
if(filePath.EndsWith(".dll") && file.StartsWith("CMS."))
{
Assembly assembly = Assembly.LoadFile(filePath);
var assemblyName = Path.GetFileNameWithoutExtension(filePath);
var assemblyID = Regex.Match(assembly.FullName, "PublicKeyToken=[a-zA-Z0-9]*").Value.Replace("PublicKeyToken=", "");
var assemblyVersion = Regex.Match(assembly.FullName, @"Version=[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*").Value.Replace("Version=", "");
sb.AppendLine(@"<dependentAssembly>");
sb.AppendLine(String.Format(@"<assemblyIdentity name=""{0}"" publicKeyToken=""{1}"" />", assemblyName, assemblyID));
sb.AppendLine(String.Format(@"<bindingRedirect oldVersion=""7.0.0.0-7.0.65535.65535"" newVersion=""{0}""/>", assemblyVersion));
sb.AppendLine(@"</dependentAssembly>");
}
}
Console.WriteLine(sb.ToString());
}
}
答案 0 :(得分:3)
它与装配方向无关。哪些只适用于运行时。您有编译时错误。
编译器担心会看到错误版本的引用程序集。当您第一次添加引用时,可能是几个月前,该版本已记录在您的项目文件中。但现在它正在重建程序,并且引用程序集不再是相同的版本。您可以告诉它不要担心,在项目的References节点中选择引用程序集,将“Specific version”属性设置为False。
现在它将采取它没有抱怨的任何版本。由于程序集的剧烈变化,请注意编译错误。非常高的赔率,你不需要在.config文件中重新定向程序集,所以删除它们。