John Vanderbeck
1 min readJun 6, 2017

--

Hi Lucas,

I wanted to follow up on this as it may be useful for you and others that may run into this issue.

I did manage to get this working with a little editor scripting. It is rather brittle, as version changes to StyleCop.Analyzers requires changes to the editor script (Just ran into that today actually) but it does work.

The main issue is that when Unity regenerates the .csproj files, it removes an ItemGroup that points to the StyleCop files, and thus while StyleCop remains in the solution, it won’t actually run for any of the individual projects. To fix this, we can hook into a Unity even that occurs as part of the Visual Studio bridge, and modify the XML to put that back. As an extra bonus, I managed to do the same with the stylecop.json file

If its ok I will direct you to the post I made on the Unity forums, which also contains my script.

Take Care!

--

--