Reputation: 371
I'm trying out ASP.NET 5 with MVC 6 but have some issues. Using Visual Studio 2015 Comm
I create a model under namespace MyApp.wwwroot.Models. Then a service under namespace MyApp.wwwroot.Service. Here I reference my model. It just shows in black, not in blue. It also has no quick actions or squigly line. When I build it says "Build Succeeded". I have the same problem when I add a reference to Microsoft.AspNet.Mvc in my Controller. When I create a new controller and inherit from Controller. I have the same issue..
Is this VS or what could be the issue?
Upvotes: 0
Views: 617
Reputation: 2271
It looks like you're trying to place code under the wwwroot
folder. The wwwroot
folder in ASP.Net Core (formerly ASP.Net 5) is used for hosting static content and these files are not parsed or compiled as C# code, but rather as static content that you want served (ex. html/css/javascript files). Moving these files out of the wwwroot
folder should fix this issue if this is the case.
Upvotes: 2
Reputation: 148
When working in your FishtankApp.Services namespace, you need to expose your model namespace. this is done by adding the following using declaration at the top of the source code document you wish to use it on:
using FishTankApp.Models ;
The same holds true for anything you wish to use that falls outside the scope of the current namespace you're working in.
Upvotes: 0