TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

Scaffold EF Core models using Handlebars templates.
MIT License
210 stars 53 forks source link

HandlebarsRuntimeException: Referenced partial name dbimports could not be resolved #13

Closed HakanCelikMK1 closed 6 years ago

HakanCelikMK1 commented 6 years ago

Hi Tony,

I'm trying to use your library to customize my scaffolding. When I try to scaffold the database I get the following exception :

HandlebarsDotNet.HandlebarsRuntimeException: Referenced partial name dbimports could not be resolved
   at HandlebarsDotNet.Compiler.PartialBinder.HandleFailedInvocation(String partialName)
   at lambda_method(Closure , TextWriter , Object )
   at HandlebarsDotNet.Handlebars.HandlebarsEnvironment.<>c__DisplayClass7_0.<Compile>b__0(Object context)
   at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpScaffoldingGenerator.WriteCode(IModel model, String outputPath, String namespace, String contextName, String connectionString, Boolean useDataAnnotations)
   at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ModelScaffolder.Generate(String connectionString, IEnumerable1 tables, IEnumerable1 schemas, String projectPath, String outputPath, String rootNamespace, String contextName, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.Internal.DatabaseOperations.ScaffoldContext(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable1 schemas, IEnumerable1 tables, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContextImpl(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable1 schemaFilters, IEnumerable1 tableFilters, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.ScaffoldContext.<>c__DisplayClass0_1.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_01.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Referenced partial name dbimports could not be resolved

My environment :

Windows 10 Enterprise 16299.192 x64 .NET Framework 4.7.1 Visual Studio 2017 Enterprise v15.5.5 .NET Core SDK v2.1.4

Project :

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <AssemblyTitle>EFScaffold API</AssemblyTitle>
    <VersionPrefix>1.1.0</VersionPrefix>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeFrameworkVersion>2.0.5</RuntimeFrameworkVersion>
    <OutputType>Library</OutputType>
    <AssemblyName>EFScaffold.API</AssemblyName>
    <PackageId>EFScaffold.API</PackageId>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
    <GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
    <ApplicationIcon>EFScaffold.API.ico</ApplicationIcon>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="EntityFrameworkCore.Scaffolding.Handlebars" Version="1.0.0-beta" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.1" PrivateAssets="All" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
    <PackageReference Include="Serilog.Settings.Configuration" Version="2.4.0" />
    <PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
    <PackageReference Include="Serilog.Sinks.MSSqlServerCore" Version="1.1.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.1" />
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.1" />
  </ItemGroup>

</Project>

Can you help me find out what the problem is ?

Regards, Hakan

tonysneed commented 6 years ago

@HakanCelikMK1 Is this still a problem with the latest version?

tonysneed commented 6 years ago

I'll re-open if necessary.