Main problem
I am creating a tool that generates MVC solutions (*. Sln) and builds (using msbuild) so that they can be deployed. The tool requires the .NET Framework 4.5.2.
Now I want to create an ASP.NET Core MVC application. Such applications can be run under 4.5.X, but I am not sure that msbuild can handle project.json (so I use package.config), and I can not install .NET Core, since each tutorial indicates that this is a prerequisite for ASP.NET core development. I am currently planning to deploy the generated applications on Windows.
Problem:
So, instead of the .NET Core project, I created a simple console application:
There I installed all the necessary packages, for example:
<package id="Microsoft.AspNetCore.Mvc" version="1.0.1" targetFramework="net452" />
SelfHosted Kestrel:
public class Program {
static void Main() {
var host = new WebHostBuilder()
.UseKestrel()
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
. , , View :

, , ASP.NET Core Web Application? MVC ?
UPDATE:
, , github issues:
public void ConfigureServices(IServiceCollection services) {
services.AddMvc()
.AddRazorOptions(options => {
var previous = options.CompilationCallback;
options.CompilationCallback = context => {
previous?.Invoke(context);
var refs = AppDomain.CurrentDomain.GetAssemblies()
.Where(x => !x.IsDynamic)
.Select(x => MetadataReference.CreateFromFile(x.Location))
.ToList();
context.Compilation = context.Compilation.AddReferences(refs);
};
});
}
, Razor . , .