question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Name 'WebHost' does not exist

See original GitHub issue

Describe 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:

  1. Using this version of ASP.NET Core 2.2
  2. Run this code
public static IWebHost BuildWebHost(string[] args) =>
             WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .Build();
  1. With these arguments ‘…’
  2. 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.

image

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:closed
  • Created 5 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
quentingarlancommented, Dec 19, 2018

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.

0reactions
glatzertcommented, Dec 29, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found