Settings.StyleCop File Will Not Open After Installing 4.5.16

May 27, 2011 at 2:43 PM

I installed 4.5.16 after being advised that it would resolve the following error on the build server:

Files\MSBuild\Microsoft\StyleCop\v4.4\Microsoft.StyleCop.Targets(94,5): error MSB4018: The "StyleCopTask" task failed unexpectedly.

System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.

However, now I receive a System.IO.FileNotFoundException, Could not load file or assembly Microsoft.StyleCop, Version=4.4.0.14... when I attempt to open the Settings.StyleCop file. If I couldn't open the settings file I had for 4.4.14 that wouldn't be overly disturbing but I can't even open the default file created during the installation process of 4.5.16.

What can I do to resolve this issue?

Thanks,

Chad

Developer
May 27, 2011 at 4:59 PM

Hi Chad,

It should be OK to open old settings file (from 4.4.0.14) with a new version (4.5.16).

The problem is that your StyleCop can't start because something wants old "Microsoft.StyleCop.dll" assembly, which is obviously absent in new StyleCop (because it's named "StyleCop.dll" now).
Don't you use any custom rules (compiled over 4.4.0.14)? 

Best regards,
Oleg Shuruev

May 27, 2011 at 5:03 PM

No custom rules of my own but I do use StyleCop+. Is there a new StyleCop+ dll that doesn't take a dependency on the old MS StyleCop dll?

May 27, 2011 at 5:04 PM

Ahhh, I see that there is. This should solve the issue.

May 27, 2011 at 6:48 PM

Should something be posted that there is a new version of StyleCop+ 1.2 that you must download if you upgrade to 4.5.16 with a link to the SC+ download?

http://stylecopplus.codeplex.com/

Developer
May 27, 2011 at 9:16 PM

You're right.

As any other StyleCop custom rules, StyleCop+ can be built with only some specific StyleCop version because strong-naming.
When StyleCop version changes, all custom rules stop working.
If there weren't strong-naming, they would work fine (at least until some changes in interfaces).

So, when StyleCop version changes, custom rules need to be rebuilt
(actually, there is another way to get them work using assembly bindings, but it is much more complicated).

As for StyleCop+, please feel free to follow it or read it by RSS to get most recent information about its releases.

Best regards,
Oleg Shuruev