Search code examples
dotvvm

DotVVM 2.0 - unable to run trial Business Pack controls


I’ve created a DotVVM Core 2.0 project using Visual Studio and I have activated a trial version of Business Pack that I have added into that project from the private feed. I have registered the Business Pack in DotvvmStartup.cs in ConfigureServices. I don’t see bp controls in IntelliSense and when I try to run web app with the bp controls I get an error that tagprefix was not registered.

I use latest version of Visual Studio 2017 Community and latest versions of DotVVM and Business Pack. Thanks for any advice.


Solution

  • Perhaps you won't call method DotvvmStartup.ConfigureServices. It is cause by "bug" in VS2017 extension template (v2.0.118.0 and below) and dotnet CLI template (dotvvm.templates.2.0.3).

    Please check Startup.ConfigureServices.

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

    You should replace services.AddDotVVM() with services.AddDotVVM<DotvvmStartup>(); https://github.com/riganti/dotvvm/blob/master/src/DotVVM.Framework.Hosting.AspNetCore/ServiceCollectionExtensions.cs#L17

    This create instance of DotvvmStartup and call method DotvvmStartup.ConfigureServices.
    DotvvmStartup object is created 2 times (services.AddDotVVM<DotvvmStartup>() and app.UseDotVVM<DotvvmStartup>(env.ContentRootPath)).