在csproj中定义AspNetCoreHostingModel引发“ npm”异常启动失败

Gre*_*eMD 5 asp.net-core

ASP.NET Core 2.2更新具有AspNetCoreHostingModel可以设置为InProcess或的此新属性OutOfProccess。如果我在中添加该属性,而csproj与设置的选项无关紧要,则会出现以下错误:

AggregateException: One or more errors occurred. (One or more errors occurred. (Failed to start 'npm'. To resolve this:
[1] Ensure that 'npm' is installed and can be found in one of the PATH directories.
Current PATH enviroment variable is: (there are some 20 paths before this last one);C:\Program Files\nodejs;
Make sure the executable is in one of those directories, or update your PATH.
Run Code Online (Sandbox Code Playgroud)

路径npm已经在此处说明,那么还有什么问题呢?

Jas*_*hen 4

我将“AspNetCoreModule”添加到 PropertyGroup 并且它起作用了。

<PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
    <AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

参考: https: //blogs.msdn.microsoft.com/webdev/2018/12/04/asp-net-core-2-2-available-today/