C # location of import statements, which makes StyleCop happy

I am a big fan of StyleCop, it makes my life easier. A bunch of other people thought about the good rules, and I am happy to follow them by turning on StyleCop. I recently fiddled with extensible Ui encoding and came across this article:

http://blogs.msdn.com/b/gautamg/archive/2010/01/05/2-hello-world-extension-for-coded-ui-test.aspx

The sample code below makes StyleCop unhappy because the statements usingare outside the namespace. However, I can only move two packages System*in - the third is needed to determine the assembly attribute, and I cannot throw assembly:inside the namespace.

Is there a clean way to reorganize this code?

using System;
using System.Diagnostics;
using Microsoft.VisualStudio.TestTools.UITest.Common;
using Microsoft.VisualStudio.TestTools.UITest.Extension;

// Attribute to denote that this assembly has UITest extensions.
[assembly: UITestExtensionPackageAttribute("HelloWorldPackage",
           typeof(UITestHelloWorldPackage.HelloWorldPackage))]

namespace UITestHelloWorldPackage
{
    internal class HelloWorldPackage : UITestExtensionPackage
    {
        public override object GetService(Type serviceType)
        {
            Trace.WriteLine("Hello, World");
            return null;
        }
....
+5
2

IMHO, .

+5

[assembly: UITestExtensionPackageAttribute()] Properties\AssemblyInfo.cs? , , , [assembly:], .

- using .

AssemblyInfo.cs . .

, !

+5

All Articles