I am writing simple consoleApp (netcoreapp2.0)
<Project Sdk="Microsoft.NET.Sdk">
and want to run webserver with mvc.
class Program
{
static void Main(string[] args)
{
WebHost.CreateDefaultBuilder()
.ConfigureServices(services => services.AddMvc())
.Configure(app => app.UseDeveloperExceptionPage().UseMvcWithDefaultRoute())
.UseHttpSys().Build().Run();
}
}
public class HomeController : Controller
{
[HttpGet] public ActionResult Index() => View("Index");
}
I get an error while GET http//localhost:5000
One or more compilation references are missing. Ensure that your project is referencing 'Microsoft.NET.Sdk.Web' and the 'PreserveCompilationContext' property is not set to false.
Probably reason is in Razor Engine. How can i make it work? What did i miss?