Namespace in HomeController.cs does not match the default name I chose on Yeoman command line #554

Closed
opened 2025-08-09 17:16:44 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @Seefer on 7/23/2017

I created a folder called vega, entered that folder and ran yo aspnetcore-spa.

For the project questions I entered the following:

? Framework Angular
? Do you want to include unit tests? No
? Your project name vega

For the last question, I simply pressed enter as it seemed to detect the project folder name as vega.

Taking a look at the files created I noticed that in HomeController.cs, the namespace in there seems incorrect.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace WebApplicationBasic.Controllers
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Error()
        {
            return View();
        }
    }
}
{
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Error()
        {
            return View();
        }
    }
}

Why is the namespace WebApplicationBasic.Controllers. Should it not reflect my project name vega?

*Originally created by @Seefer on 7/23/2017* I created a folder called **vega**, entered that folder and ran `yo aspnetcore-spa`. For the project questions I entered the following: ``` ? Framework Angular ? Do you want to include unit tests? No ? Your project name vega ``` For the last question, I simply pressed enter as it seemed to detect the project folder name as vega. Taking a look at the files created I noticed that in HomeController.cs, the namespace in there seems incorrect. ``` using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; namespace WebApplicationBasic.Controllers { public class HomeController : Controller { public IActionResult Index() { return View(); } public IActionResult Error() { return View(); } } } { public class HomeController : Controller { public IActionResult Index() { return View(); } public IActionResult Error() { return View(); } } } ``` Why is the namespace `WebApplicationBasic.Controllers`. Should it not reflect my project name vega?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#554
No description provided.