生成新的 ServiceStack React 项目缺少 SharpPagesFeature

Generating a new ServiceStack React Project is missing SharpPagesFeature

我更新到最新的@servicestack/cli

npm install -g @servicestack/cli
+ @servicestack/cli@1.0.8
updated 5 packages in 5.862s

运行 dotnet-new 命令:

C:\Projects\Personal> dotnet-new react-spa POETS

> uglifyjs-webpack-plugin@0.4.6 postinstall C:\Projects\Personal\POETS\POETS\node_modules\webpack\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js


> poets@0.1.0 postinstall C:\Projects\Personal\POETS\POETS
> npm run build


> poets@0.1.0 build C:\Projects\Personal\POETS\POETS
> rimraf wwwroot/ && react-scripts-ts build && (move build wwwroot || mv build wwwroot)

Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
ts-loader: Using typescript@3.2.4 and C:\Projects\Personal\POETS\POETS\tsconfig.prod.json
Compiled successfully.

File sizes after gzip:

  80.72 KB  build\static\js\main.5832e8d6.js
  29.7 KB   build\static\css\main.4df18a76.css

The project was built assuming it is hosted at the server root.
You can control this with the homepage field in your package.json.
For example, add this to build it for GitHub Pages:

  "homepage" : "http://myname.github.io/myapp",

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build



        1 dir(s) moved.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1564 packages in 27.283s
MSBuild auto-detection: using msbuild version '16.0.360.33175' from 'C:\Program Files (x86)\Microsoft Visual Studio19\Preview\MSBuild\Current\bin'.
Restoring packages for C:\Projects\Personal\POETS\POETS.ServiceInterface\POETS.ServiceInterface.csproj...
Restoring packages for C:\Projects\Personal\POETS\POETS.Tests\POETS.Tests.csproj...
Restoring packages for C:\Projects\Personal\POETS\POETS\POETS.csproj...
Restoring packages for C:\Projects\Personal\POETS\POETS.ServiceModel\POETS.ServiceModel.csproj...
  GET https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/index.json
  GET https://api.nuget.org/v3-flatcontainer/servicestack/index.json
  GET https://api.nuget.org/v3-flatcontainer/nunit/index.json
  GET https://api.nuget.org/v3-flatcontainer/microsoft.net.test.sdk/index.json
  GET https://api.nuget.org/v3-flatcontainer/nunit3testadapter/index.json
  GET https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/index.json
  OK https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/index.json 194ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/5.4.0/servicestack.kestrel.5.4.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/nunit/index.json 237ms
  OK https://api.nuget.org/v3-flatcontainer/microsoft.net.test.sdk/index.json 246ms
  OK https://api.nuget.org/v3-flatcontainer/nunit3testadapter/index.json 248ms
  OK https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/index.json 263ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/5.4.0/servicestack.interfaces.5.4.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/servicestack/index.json 318ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack/5.4.0/servicestack.5.4.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/servicestack.kestrel/5.4.0/servicestack.kestrel.5.4.0.nupkg 162ms
  OK https://api.nuget.org/v3-flatcontainer/servicestack.interfaces/5.4.0/servicestack.interfaces.5.4.0.nupkg 149ms
  OK https://api.nuget.org/v3-flatcontainer/servicestack/5.4.0/servicestack.5.4.0.nupkg 151ms
Installing ServiceStack.Interfaces 5.4.0.
  GET https://api.nuget.org/v3-flatcontainer/servicestack.client/index.json
  GET https://api.nuget.org/v3-flatcontainer/servicestack.common/index.json
  OK https://api.nuget.org/v3-flatcontainer/servicestack.client/index.json 158ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack.client/5.4.0/servicestack.client.5.4.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/servicestack.common/index.json 173ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack.common/5.4.0/servicestack.common.5.4.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/servicestack.client/5.4.0/servicestack.client.5.4.0.nupkg 148ms
  OK https://api.nuget.org/v3-flatcontainer/servicestack.common/5.4.0/servicestack.common.5.4.0.nupkg 146ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack.text/index.json
  OK https://api.nuget.org/v3-flatcontainer/servicestack.text/index.json 159ms
  GET https://api.nuget.org/v3-flatcontainer/servicestack.text/5.4.0/servicestack.text.5.4.0.nupkg
  OK https://api.nuget.org/v3-flatcontainer/servicestack.text/5.4.0/servicestack.text.5.4.0.nupkg 162ms
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceModel\obj\POETS.ServiceModel.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceModel\obj\POETS.ServiceModel.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS.ServiceModel\obj\project.assets.json
Restore completed in 1.79 sec for C:\Projects\Personal\POETS\POETS.ServiceModel\POETS.ServiceModel.csproj.
Installing ServiceStack.Text 5.4.0.
Installing ServiceStack.Client 5.4.0.
Installing ServiceStack.Common 5.4.0.
Installing ServiceStack 5.4.0.
Installing ServiceStack.Kestrel 5.4.0.
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceInterface\obj\POETS.ServiceInterface.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS.ServiceInterface\obj\POETS.ServiceInterface.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS.ServiceInterface\obj\project.assets.json
Restore completed in 2.82 sec for C:\Projects\Personal\POETS\POETS.ServiceInterface\POETS.ServiceInterface.csproj.
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS.Tests\obj\POETS.Tests.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS.Tests\obj\POETS.Tests.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS.Tests\obj\project.assets.json
Restore completed in 2.84 sec for C:\Projects\Personal\POETS\POETS.Tests\POETS.Tests.csproj.
Committing restore...
Generating MSBuild file C:\Projects\Personal\POETS\POETS\obj\POETS.csproj.nuget.g.props.
Generating MSBuild file C:\Projects\Personal\POETS\POETS\obj\POETS.csproj.nuget.g.targets.
Writing lock file to disk. Path: C:\Projects\Personal\POETS\POETS\obj\project.assets.json
Restore completed in 2.86 sec for C:\Projects\Personal\POETS\POETS\POETS.csproj.

NuGet Config files used:
    C:\Projects\Personal\POETS\NuGet.Config
    C:\Users\willi\AppData\Roaming\NuGet\NuGet.Config
    C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

Feeds used:
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
    https://api.nuget.org/v3/index.json

Installed:
    1 package(s) to C:\Projects\Personal\POETS\POETS.ServiceModel\POETS.ServiceModel.csproj
    5 package(s) to C:\Projects\Personal\POETS\POETS.ServiceInterface\POETS.ServiceInterface.csproj
    6 package(s) to C:\Projects\Personal\POETS\POETS.Tests\POETS.Tests.csproj
    5 package(s) to C:\Projects\Personal\POETS\POETS\POETS.csproj

2017 年 Visual Studio 打开应用程序,缺少对 SharpPagesFeature 的依赖。

public override void Configure(Container container)
    {
        Plugins.Add(new SharpPagesFeature()); // <--- Can't resolve this

        SetConfig(new HostConfig
        {
            AddRedirectParamsToQueryString = true,
            DebugMode = AppSettings.Get(nameof(HostConfig.DebugMode), false)
        });
    }

有人知道这是什么包吗?我在 GitHub 上看到 SharpPagesFeature 在主命名空间 (ServiceStack) 中。

编辑

此外,生成的 MyService.cs 具有不正确的依赖关系和缺失的导入:

using ServiceStack.Script; <--- this can't be resolved and is unused

new PageResult(Request.GetPage("/")); <-- this requires me to import ServiceStack.Templates.PageResult (which resolves fine)

您安装了旧的 pre-release v5.4.1 of ServiceStack

您需要clear your NuGet packages cache安装最新版本,例如:

$ nuget locals all -clear