c# - Assembly Redirection doesn't seem to get applied -
i'm trying sort out assembly redirection i'm having problems with, unfortunately doesn't seem working @ moment. i've checked standard things (and i've generated script that's worked) , can't figure out what's wrong. these errors:
while current setup is:
i don't want use b.b version of dll's i've got app.config tests.csproj file setup following:
<?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>
the scriptcs script i've used generate these:
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()); } }
it doesn't have assembly direction. applies @ runtime. have compile-time errors.
the compiler fretting seeing wrong version of reference assembly. version recorded in project file when first added reference, possibly months ago. rebuilding program , reference assembly no longer same version. can tell not worry that, select reference assembly in references node of project, set "specific version" property false.
it take whatever version finds without complaint. beware of compile errors due drastic changes in assembly. high odds don't need assembly redirects in .config file, remove them.
Comments
Post a Comment