StyleCop.Resharper + Code Cleanup + StyleCop rules
sguryev opened this issue · comments
Hi there.
I have a pretty simple task and last 4 hours I have been trying to implement it with almost no luck.
I hope you will be able to advise me and help.
My config is:
VS2017 15.9.1
R# Ultimate 2018.2.3
StyleCop by JetBrains 2018.2.0
My goals are:
- Generate the header for each file
- Generate the doc stubs for each (public) member
- Enable build errors for related (1, 2) StyleCop issues
My steps (story):
I have installed the StyleCop R# extension and restart the VS. I have got the StyleCop
Code Cleanup profile and enabled the Create XML doc stub
option. After the cleanup I was able to get the header and member docs. Unfortunately there was no company name int the header and it was not complained with one of the StyleCop rule. So I have started searching a way to resolve it.
I have realized that there is no other way for comfortable editing the Settings.StyleCop
file except installing the VS StyleCop extension (by right mouse button click on a project). I was able to update the company name and copyright text there. After running the code cleanup again I have lost the summary section of the header (which has been generated as copy of the doc for the class in the file). I have tried to play with the R# header settings but it looks like StyleCop wins over the R# for header config. Based on the pretty old blog post here there was a setting:
allowed to configure the header cleanup. But it has gone.
My questions are:
- How to config the header in order to add the summary and copyright (both are generated) at the same time with Code Cleanup?
- Should I install StyleCop as the separate VS extension or not in order to use the R# one?
- How can I fix this error during opening the StyleCop settings (exception occurred while loading one of the StyleCop add-ins
TypeLoadException
from assemblyTestPlatform.ObjectModel
)
.
Right now I have to disable the VS StyleCop, restart the VS, enable the plugin and restart again. It works till the next VS restart.
I have noticed that Alt+Enter R# fix add the full header (copyright + summary):
But the Code Cleanup one add a copyright only:
And Code Cleanup replaces the full header with the short one during the cleanup process.
Thank you!
UPD: After R# repairing I can't run the VS StyleCop even after reinstalling the extension
2277 | ERROR | LegacySitePackage failed for package [StyleCop.VisualStudio.StyleCopVSPackage, StyleCop.VisualStudio, Version=5.0.0.0, Culture=neutral, PublicKeyToken=f904653c63bc2738]Source: 'mscorlib' Description: Could not load type 'Microsoft.VisualStudio.TestPlatform.ObjectModel.InProcDataCollector.InProcDataCollection' from assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. System.TypeLoadException: Could not load type 'Microsoft.VisualStudio.TestPlatform.ObjectModel.InProcDataCollector.InProcDataCollection' from assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) at System.Reflection.RuntimeAssembly.GetExportedTypes() at StyleCop.StyleCopCore.LoadAddins(String path, Byte[] publicKey) at StyleCop.StyleCopCore.Initialize(ICollection`1 addInPaths, Boolean loadFromDefaultPath) at StyleCop.VisualStudio.StyleCopVSPackage.InitializeMenus() at StyleCop.VisualStudio.StyleCopVSPackage.Initialize() at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp) | {629EB7CC-69C2-43AC-9BC9-482B0F810C4E} | 80131522 | VisualStudio | 2018/11/19 20:35:07.976
-- | -- | -- | -- | -- | -- | --
2278 | ERROR | SetSite failed for package [StyleCop.VisualStudio.StyleCopVSPackage, StyleCop.VisualStudio, Version=5.0.0.0, Culture=neutral, PublicKeyToken=f904653c63bc2738](null) | {629EB7CC-69C2-43AC-9BC9-482B0F810C4E} | 80131522 | VisualStudio | 2018/11/19 20:35:07.979
2279 | ERROR | End package load [StyleCop.VisualStudio.StyleCopVSPackage, StyleCop.VisualStudio, Version=5.0.0.0, Culture=neutral, PublicKeyToken=f904653c63bc2738] | {629EB7CC-69C2-43AC-9BC9-482B0F810C4E} | 80131522 | VisualStudio | 2018/11/19 20:35:07.984