I just created an MVC app with dotnet new mvc --name test-project
(netcoreapp3.1
), without any kind of database access and Identity, which I would like to add by hand for customisation purposes. Then I added some packages in order to use the dotnet aspnet-codegenerator
tool. My .csproj
looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>test_project</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
</ItemGroup>
</Project>
As you can see, the Microsoft.VisualStudio.Web.CodeGeneration.Design
is the first in the list. However, when I try to run any scaffolder from the dotnet aspnet-codegenerator
tool (e.g.: dotnet aspnet-codegenerator identity -h
), I get the following message:
No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
Even if I specify the .csproj
file with the -p
flag, I still get the same message.
While doing some research, I found this Issue on their repo, but it's a different thing: the OP was trying to add the scaffolder to a .NET Core App 3.0 using the 3.1 scaffolder version.
I'm using .NET 3.1.401 on Xubuntu 20.04.
Any thoughts? Thank you in advance.
EDIT 1
Some people suggested this would be close to what we have here, but the thing is: I know what it does and I actually added the "global tools" suggested in that article. The problem is the aspnet-codegenerator
is not detecting that I already have the library it needs to its things, added to the .csproj
file.
EDIT 2
Apparently, there's a couple of people facing this issue as well, so, I filed an issue on their repo
dotnet restore
– Chaffeedotnet clean
,dotnet restore
anddotnet build
it didn't work here, unfortunately – Harney