2
Vote

tied to a specific version of StyleCop?

description

This tool is very useful to us. However it seems to be tied to the version of StyleCop (4.3.1.3) bundled with it, whereas our development environments use 4.4.0.14. I tried replace the three .DLL files but it threw
 
Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.StyleCop, Version=4.3.1.3, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
 
I don't see access to the source. Is there some way I can point the executable to the newer version of StyleCop?
 
Regardless, thanks for making this available.

comments

shuruev wrote Feb 1, 2011 at 8:39 PM

You could try assemly binding (like described here: http://stylecopplus.codeplex.com/wikipage?title=Compatibility%20Issues - but obviously with another version numbers).
If you are lucky and this tool doesn't uses interfaces changed from 4.3 to 4.4 (there were several) - it will work.

The best way of course is to wait untail new version is released, my solution is just a workaround that could probably help.

dpm wrote Feb 2, 2011 at 12:12 PM

Danke! I added these lines
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.StyleCop" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="4.3.1.3" newVersion="4.4.0.14" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.StyleCop.CSharp" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="4.3.1.3" newVersion="4.4.0.14" />
        </dependentAssembly>
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.StyleCop.CSharp.Rules" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="4.3.1.3" newVersion="4.4.0.14" />
        </dependentAssembly>
    </assemblyBinding>
</runtime>
after the <configSections> block, copied the three .DLLs in, and it worked great.

Thank you!

wrote Aug 23, 2011 at 9:42 AM

wrote Feb 13, 2013 at 7:47 PM