A "using" statement gets moved automatically outside of the namespace

45 views Asked by At

A file within a custom VS project template is getting altered automatically by VS when the template is used to create a project.

Code in the template zip file:

using Enterprise.Utilities.ServiceBase.Requests;
using Enterprise.Utilities.ServiceBase.Responses;

namespace TemplateAspnetCore.ExamplesRestService
{
    using System = global::System;
    // ....
}

Code when the template is used to create a new project:

using Enterprise.Utilities.ServiceBase.Requests;
using Enterprise.Utilities.ServiceBase.Responses;
using System = global::System;

namespace NewProjectName.ExamplesRestService
{
    // ....
}

Any ideas on what might cause a using statement to move outside the namespace?

I expected the file to remain as is, and expected the using statement to stay within the namespace, as in the original file.

I can fix the issue in the created project by moving that using statement back into the namespace. But since it's a template, it would be nice if no manual step were required.

0

There are 0 answers