TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
277.8k
error CS0234: The type or namespace name 'Hosting' does not exist in t
May 19 2021 9:47 AM
I work on visual studio 2017 asp.net core 2.2 when create new api controller I get Error
There was an error running the template C:\Users\ahmed.barbary\.nuget\packages\microsoft.visualstudio.web.codegenerators.mvc\2.2.3\Templates\ControllerGenerator\ApiEmptyController.cshtml: Template Processing Failed:(4,47): error CS0234: The type or
namespace
name
'Hosting'
does not exist
in
the
namespace
'Microsoft.AspNetCore.Razor'
(are you missing an assembly reference?)
(10,41): error CS0234: The type or
namespace
name
'Hosting'
does not exist
in
the
namespace
'Microsoft.AspNetCore.Razor'
(are you missing an assembly reference?)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
why this error happen and how to solve it
project file as controller project as below :
<Project Sdk=
"Microsoft.NET.Sdk.Web"
>
<PropertyGroup Label=
"Globals"
>
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition=
"'$(Configuration)|$(Platform)'=='Release|AnyCPU'"
>
<DefineConstants>TRACE;RELEASE;NETCOREAPP;NETCOREAPP2_2</DefineConstants>
<Optimize>
true
</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>
true
</DebugSymbols>
<MvcRazorCompileOnPublish>
false
</MvcRazorCompileOnPublish>
</PropertyGroup>
<ItemGroup>
<Folder Include=
"wwwroot\"
/>
</ItemGroup>
<ItemGroup>
<PackageReference Include=
"Microsoft.AspNetCore.All"
Version=
"2.0.0"
/>
<PackageReference Include=
"Microsoft.VisualStudio.Web.CodeGeneration.Design"
Version=
"2.2.3"
/>
<PackageReference Include=
"Microsoft.Windows.Compatibility"
Version=
"3.1.0"
/>
<PackageReference Include=
"Serilog.Extensions.Logging.File"
Version=
"2.0.0"
/>
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include=
"Microsoft.VisualStudio.Web.CodeGeneration.Tools"
Version=
"2.0.0"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include=
"..\Framework.Model\Framework.Model.csproj"
/>
<ProjectReference Include=
"..\Framework.MSSQL\Framework.MSSQL.csproj"
/>
<ProjectReference Include=
"..\Framework.Services\Framework.Services.csproj"
/>
</ItemGroup>
<ItemGroup>
<Reference Include=
"Z2Data.Utils.BaseRepository"
>
<HintPath>..\..\..\dll\Z2Data.Utils.BaseRepository.dll</HintPath>
</Reference>
<Reference Include=
"Z2Data.Utils.DataMappingHelper"
>
<HintPath>..\..\..\dll\Z2Data.Utils.DataMappingHelper.dll</HintPath>
</Reference>
<Reference Include=
"Z2Data.Utils.DataProvider"
>
<HintPath>..\..\..\dll\Z2Data.Utils.DataProvider.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
to get version of .net core
i write
dotnet --info
and result
Microsoft Windows [Version 10.0.10586]
(c) 2015 Microsoft Corporation. All rights reserved.
C:\Windows\system32>dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.110
Commit: 4797dabd3c
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.110\
Host (useful
for
support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
1.1.14 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.509 [C:\Program Files\dotnet\sdk]
2.2.110 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
so how to solve issue please
I can't create New api controller
Reply
Answers (
4
)
Web Api and tokens
how to add new row sum of column in excelsheet