DotVVM 2.0-无法运行试用版Business Pack控件

时间:2018-07-15 03:28:39

标签: dotvvm

我已经使用Visual Studio创建了DotVVM Core 2.0项目,并且激活了我从私有供稿添加到该项目的Business Pack的试用版。我已经在ConfigureServices的DotvvmStartup.cs中注册了Business Pack。我在IntelliSense中看不到bp控件,当我尝试使用bp控件运行Web应用程序时,出现一个错误,提示未注册tagprefix。

我使用Visual Studio 2017社区的最新版本以及DotVVM和Business Pack的最新版本。感谢您的任何建议。

1 个答案:

答案 0 :(得分:0)

  

也许您不会调用方法DotvvmStartup.ConfigureServices。这是由VS2017扩展模板(v2.0.118.0及更低版本)和dotnet CLI模板(dotvvm.templates.2.0.3)中的“错误”引起的。

请检查Startup.ConfigureServices

  public void ConfigureServices(IServiceCollection services)
  {
      ...
      services.AddDotVVM(); //this line is incorrect
  }

您应将services.AddDotVVM()替换为services.AddDotVVM<DotvvmStartup>(); https://github.com/riganti/dotvvm/blob/master/src/DotVVM.Framework.Hosting.AspNetCore/ServiceCollectionExtensions.cs#L17

此创建的DotvvmStartup实例和调用方法DotvvmStartup.ConfigureServices
DotvvmStartup对象创建了两次(services.AddDotVVM<DotvvmStartup>()app.UseDotVVM<DotvvmStartup>(env.ContentRootPath))。