using statements are inside a class definition

Jun 5, 2014 at 5:45 PM
when I run razorgenerator.msbuild on a razor file that has @using statements, these statements are pulled internal to the class that is created. This is a little surprising, and sometimes breaks my build.

Input:
@using SomeNameSpace
<div> </div>
Actual Output:
namespace Path.To.My.File
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net;

    using SomeNameSpace;

    public partial class Foo_FromRazorGenerator : System.Web.Mvc.WebViewPage<dynamic>
    {
        public Foo_FromRazorGenerator()
        {
        }
        public override void Execute()
        {

WriteLiteral("<div> </div>\r\n");


        }
    }
}
Preferred Output:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;

using SomeNameSpace;

namespace Path.To.My.File
{

    public partial class Foo_FromRazorGenerator : System.Web.Mvc.WebViewPage<dynamic>
    {
        public Foo_FromRazorGenerator()
        {
        }
        public override void Execute()
        {

WriteLiteral("<div> </div>\r\n");


        }
    }
}
Coordinator
Jun 5, 2014 at 5:50 PM
That is the way Razor always generates using statements, so this is not related to RazorGenerator. We're just calling the standard generator.