I am switching from ASP.NET Core 1.x to v2.0 using the following post on docs.microsoft: https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to -2x /
I am almost done with all the changes mentioned in this post. But there is one mistake that causes problems.
Here is my Program.cs file:
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Configuration;
namespace MeridiaCoreAPI
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.ConfigureAppConfiguration((hostContext, config) =>
{
config.Sources.Clear();
config.AddJsonFile("myconfig.json", optional: true);
})
.Build();
}
}
And here is the error message:
Suppression State
Error CS0103 The name 'WebHost' does not exist in the current context
Any solution, workaround or hint would be much appreciated. Thank you
source
share