dotnet / Scaffolding

Code generators to speed up development.
MIT License
642 stars 230 forks source link

identity generator not compatible with old style entrypoint `length must be a non-negative value ` Scaffolding Fails with Old-Style Entrypoint Programs #3045

Open bukowa opened 2 weeks ago

bukowa commented 2 weeks ago
$ dotnet aspnet-codegenerator identity -dbProvider sqlite
Building project ...
Finding the generator 'identity'...
Running the generator 'identity'...
length ('-639') must be a non-negative value. (Parameter 'length')
Actual value was -639.
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)
RunTime 00:00:32.26
<Project Sdk="Microsoft.NET.Sdk.Web">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="Asp.Versioning.Mvc.ApiExplorer" Version="8.1.0" />
      <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.0" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
      <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      </PackageReference>
      <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
      <PackageReference Include="Swashbuckle.AspNetCore" Version="6.9.0" />
      <PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.9.0" />
    </ItemGroup>

</Project>
$ dotnet --version
8.0.403
bukowa commented 2 weeks ago

aspnet-codegenerator identity won't work when your application is using class Program static Run(string[] args) top level statement Adding this code causes the error Image incompatible

deepchoudhery commented 6 days ago

Will take a look at this bug soon but for a workaround, please try our new command-line scaffolding tool, dotnet-scaffold