c# - Using Directives, Namespace and Assembly Reference - all jumbled up with StyleCop! -


I like to follow the formatting rules of StyleCop to make the code look good and clear, but recently I Warning to any one:

All instructions should be used within the namespace.

My problem is that I am using the instructions, a assembly reference (to delete the file for fun), and a namespace to juggle me in one of my test classes:

  using the system; Using System.IO; Using Microsoft.Moles.Fraamework; Use of Microsoft Visual Studio Test Tools Unitatistics; [Assembly: MoledType (typeof (System.IO.File)]] Namespace MyNamespace {// some code}  

The above tests allow for fine-tuning - but the instructions that use StyleCop Complains about the name is not inside the place.

Excluding the use in the name space gives an error that "molted type" is not recognized.

The names put both the utilities and the assembly references inside names

'Declaration' is not a valid specialization location for this declaration. Valid attribute locations for this announcement are 'types'. All features in this block will be ignored.

It seems that I have tried every layout, but I can not take any advantage - either the solution will not be created, the joke will not work or the styling will complain!

Does anyone know one way to set them up so that everything is happy? Or will I ignore the Warning of the StyleCop in this case?

Solved after two minutes!

I need to put the full way to the "Molted Type" in the assembly reference - which means that I can leave it outside the namespace and leave it in the same way with the instructions:

  [Assembly: Microsoft.moles.fromwork MoldType (Typf (System. IoFile))] namespace minespace {using system; Using System.IO; Using Microsoft.Moles.Fraamework; Use of Microsoft Visual Studio Test Tools Unitatistics; // some code ...}  

Hope someone will find this useful!


Comments