Name 'WebHost' does not exist
See original GitHub issueDescribe the bug
When using netcoreapp2.2 and Asp net Core 2.2.0 I get the error ‘WebHost’ does not exist in my buildWebHost function, going back to net Core 2.1 fix the issue.
To Reproduce
Steps to reproduce the behavior:
- Using this version of ASP.NET Core 2.2
- Run this code
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
- With these arguments ‘…’
- See error
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
CsProj
<Project Sdk="Microsoft.NET.Sdk.Web"> <PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> </PropertyGroup> <PropertyGroup> <GenerateDocumentationFile>true</GenerateDocumentationFile> <NoWarn>$(NoWarn);1591</NoWarn> <DockerTargetOS>Linux</DockerTargetOS> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <DocumentationFile>obj\Debug\netcoreapp2.1\Itga.Saam.WebApi.xml</DocumentationFile> </PropertyGroup> <ItemGroup> <Compile Remove="Controllers\ValuesController.cs" /> </ItemGroup> <ItemGroup> <Folder Include="wwwroot\" /> </ItemGroup> <ItemGroup> <PackageReference Include="AutoMapper" Version="8.0.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="6.0.0" /> <PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" /> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.1.1" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" /> </ItemGroup> </Project>Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
The name WebHost does not exists in current context
WebHost class resides Microsoft.AspNetCore assembly that comes with Microsoft.AspNetCore.All NuGet package. So to fix you problem install ...
Read more >The name "WebHost" does not exist · Issue #4787
Describe the bug I get the following error: The name 'WebHost' does not exist in the current context. As I can see the...
Read more >[Fix]-The name WebHost does not exists in current context
WebHost class resides Microsoft.AspNetCore assembly that comes with Microsoft.AspNetCore.All NuGet package. So to fix you problem install this NuGet package ...
Read more >ASP.NET Core Web Host
Learn about Web Host in ASP.NET Core, which is responsible for app startup and lifetime management.
Read more >Error: "The web host domain.xyz does not exist"
This guide is for you if you get the error The web host does not exist while visiting your site's address. Origin. This...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Something must have been missing in bin/debug, I noticed a permission error while building with VS code. I could fix it by building while running in administrator mode.
I’ve experienced this too, when I created a new project with ASP.NET Core 2.1 and then moved to ASP.NET Core 2.2 (by installing the SDK).
Deleting the obj folder fixed it for me.