Scaffolding: Microsoft.VisualStudio.Web.CodeGeneration.Design package not being found by the dotnet aspnet-codegenerator tool

Created on 20 Aug 2020  ·  55Comments  ·  Source: dotnet/Scaffolding

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 in the 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 dotnet 3.1.401 on Xubuntu 20.04.

Any thoughts? Thank you in advance.

Steps to reproduce:

  • Install latest dotnet through MS repos
  • dotnet tool install dotnet-aspnet-codegenerator --version 3.1.4
  • dotnet new mvc
  • dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design -v 3.1.4 && dotnet restore && dotnet build
  • dotnet aspnet-codegenerator identity -h

Expected behaviour:

  • The Scaffolding tool should at least show any helpful information about the scaffolder

Actual behaviour:

  • It shows the following message, even after adding the referred NuGet Package to the project: No code generators are available in this project. Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.

Additional information about the project being scaffolded, such as:

Target framework(s): netcoreapp3.1

Package version of Microsoft.AspNetCore.App or Microsoft.AspNetCore.All (if applicable):

Package version of Microsoft.VisualStudio.Web.CodeGeneration.Design - this may be added to your project by scaffolding: 3.1.4, actually this problem can be reproduced even with the 3.1.3 version of it.

Most helpful comment

Since @mwdmwd was able to find the root cause for the problem, I was successful with the following workaround (using Ubuntu 18.04 and .NET 5.0):

Create a dummy vfat filesystem:

dd if=/dev/zero of=/tmp/mynuget bs=1024k count=2000
mkfs.vfat /tmp/mynuget

Mount it in place of your nuget directory:

sudo mount -o uid=myuser,gid=myuser -t vfat /tmp/mynuget /home/myuser/.nuget

Then, after running dotnet restore the scaffolding works as expected.

All 55 comments

I'm getting the same problem here! I'm a Ubuntu user and I still waiting for a fix

Hmmm there have been a few too many similar issues on Ubuntu seems like. I'll try to get an update soon. I'll update this thread when ready for one. For a workaround, you may use version 3.1.3.

Dear @deepchoudhery, Unfortunately, I'm getting the same problems with version 3.1.3 as well, as I mentioned at the "Additional Information" section. Maybe it is something related to the dotnet version? Thank you for your time!

I have the exact same problem. Fresh Ubuntu 20.04 installation, fresh installation of .NET Core 3.1 SDK, followed the setup steps by the book. I tested 3.1.4 and each version back to 3.1.0, and none of them work. I always get the No code generators are available in this project. error when running with the --help flag. And if I try to run the scaffolding tool to generate some pages, I get: No code generators found with the name 'razor page'.

dotnet version: 3.1.401

Maybe I have an idea on how to start fixing. How do you usually test the code generation and how someone could contribute to this project?
From my findings, I got that the project context is being built inside of the file MsBuildProjectContextBuilder.cs.

For some reason, I think that the context builder is not managing to get/find the Microsoft.VisualStudio.Web.CodeGeneration.Design file from the nuget packages list. Of course, this will require some debugging/testing, but I think it's a start anyway.

@cezarlamann what platform would you be building and testing on? I can help you setup for sure.

@deepchoudhery I have here the following environments: linux x86_64 (vscode), windows 10 pro x86_64 (VM, with VS 2019), and also a raspberry pi 2 running raspbian (ARM 32 bits).

@cezarlamann , @deepchoudhery I ran into a similar issue on Ubuntu 20.04.1LTS (64bit).

In addition when running,

dotnet aspnet-codegenerator controller -name CandidateController -m Candidate --relativeFolderPath Controllers -api -dc CandidateContext`

it requested me to add Microsoft.EntityFrameworkCore.SqlServer to the project for completing the process even when I am using Sqlite.
Please feel free to use the sample projcet to find the issue

@srinath999 you need to add the --useSqlite or -sqlite flag for the tool to know sqlite is being used. Otherwise it looks for sqlserver.

Originally, I have those Code Generators available as expected. However, after I have updated the .NET Core SDK as version 3.1.401, it is now reported that "No code generators are available in this project."

I am getting the same issue on Windows 10 version 2004, both within and outside of WSL 2. Edit: downgrading .Net Core to 2.1 does fix it.

dotnet aspnet-codegenerator --help


Usage: aspnet-codegenerator [arguments] [options]

Arguments:
  generator  Name of the generator. Check available generators below.

Options:
  -p|--project             Path to .csproj file in the project.
  -n|--nuget-package-dir   
  -c|--configuration       Configuration for the project (Possible values: Debug/ Release)
  -tfm|--target-framework  Target Framework to use. (Short folder name of the tfm. eg. net46)
  -b|--build-base-path     
  --no-build               

No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.

This is also a problem in .Net 5.0.100-preview.8 with dotnet-aspnet-codegenerator 5.0.0-preview.8.20419.1, even after installing Microsoft.VisualStudio.Web.CodeGeneration.Design 5.0.0-preview.8.20419.1.

@stephen-innotek There are issues with the Code Generation tool and 3.1.401 sdk. I'm working on a fix for that. Are you on the linux platform by any chance?

@MadeleineRoberts-WellSky I am aware of this issue as well. There is another package coming soon but there is an issue with 5.0-Preview8 sdk. Preview sdks will be a bit more unstable but will be ironed out in an update in the coming weeks. You may roll back the sdk as a workaround.

@deepchoudhery I'm getting this error with .NET 5 SDK RC1. I think better error messages are needed.

@stephen-innotek There are issues with the Code Generation tool and 3.1.401 sdk. I'm working on a fix for that. Are you on the linux platform by any chance?

@deepchoudhery - I see the same issue on OSX too. Assuming that this fix could apply to me as well. I've tried the same troubleshooting steps that @cezarlamann mentioned in the original issue post.

FWIW, below is the output from dotnet --info

```
.NET Core SDK (reflecting any global.json):
Version: 3.1.401
Commit: 39d17847db

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.15
OS Platform: Darwin
RID: osx.10.15-x64
Base Path: /usr/local/share/dotnet/sdk/3.1.401/

Host (useful for support):
Version: 3.1.7
Commit: fcfdef8d6b

.NET Core SDKs installed:
3.1.102 [/usr/local/share/dotnet/sdk]
3.1.401 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
````

In Pop OS 20.04 I solved this with sdk and aspnet-codegenerator downgrade
sudo apt install dotnet-sdk-3.1=3.1.301-1
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
This is my dotnet --info
`SDK de .NET Core (reflejando cualquier global.json):
Version: 3.1.301
Commit: 7feb845744

Entorno de tiempo de ejecución:
OS Name: pop
OS Version: 20.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.301/

Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd

.NET Core SDKs installed:
3.1.301 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
`

I can confirm that downgrading the dotnet-sdk to 3.1.301-1 fixes the issue on Ubuntu 20.04.1.

Experiencing the same issue. Downgrading to 3.1.301 hasn't solved the issue on MacOS Catalina.

I filed an issue in AspNetCore.Docs, as I ran into this problem in the starter tutorial suggested and linked by the 'Hello World in 10min'

my dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.301
 Commit:    7feb845744

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.301/

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  3.1.301 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@sanjitn
Small update for mac users: I asked somebody who has [Visual Studio for Mac] installed to test this. It works fine using the IDE, but he still got the same error when he tried to do it from the command line. So you can use the IDE for those steps until this is fixed.

his dotnet --info:

.NET Core SDK (reflecting any global.json):
 Version:   3.1.402
 Commit:    9b5de826fd

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /usr/local/share/dotnet/sdk/3.1.402/

Host (useful for support):
  Version: 3.1.8
  Commit:  9c1330dedd

.NET Core SDKs installed:
  2.1.504 [/usr/local/share/dotnet/sdk]
  3.0.100-preview3-010431 [/usr/local/share/dotnet/sdk]
  3.1.100 [/usr/local/share/dotnet/sdk]
  3.1.200 [/usr/local/share/dotnet/sdk]
  3.1.401 [/usr/local/share/dotnet/sdk]
  3.1.402 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.0.0-preview3-19153-02 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.21 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.0.0-preview3-27503-5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

@deepchoudhery do you have any documentation on how to set up the build process for this project properly? I'm willing to help in testing, because I have at least three platforms here to test, and I'm sure that if we have documentation on how to build it, more people will be willing to test (especially the ones on Mac OS, which I don't have).

@cezarlamann I'll try to add some documentation very soon for Windows. I'll also some helper scripts + docs for Mac, and Linux.

[...] and I'm sure that if we have documentation on how to build it, more people will be willing to test (especially the ones on Mac OS, which I don't have).

@cezarlamann I can second that. I'm pretty swamped for time currently, but as long as i have a straight forwar way of setting it up, i'll gladly run some testing for MacOS

I can confirm that downgrading the dotnet-sdk to 3.1.301-1 fixes the issue on Ubuntu 20.04.1.

Can confirm It also fixes this issue on Ubuntu 16.04

@srinath999 you need to add the --useSqlite or -sqlite flag for the tool to know sqlite is being used. Otherwise it looks for sqlserver.

@deepchoudhery are there flags for when using something other than SQLServer or SqlLite? I don't see these flags in the docs.

Does not seem to fix it on opensuse-leap, downgraded to 3.1.301

.NET Core SDK (reflecting any global.json):
 Version:   3.1.301
 Commit:    7feb845744

Runtime Environment:
 OS Name:     opensuse-leap
 OS Version:  15.2
 OS Platform: Linux
 RID:         linux-x64

On this version I can't create projects.

Same problem on Ubuntu 20.04 & latest version of SDK

.NET SDK (reflecting any global.json):
 Version:   5.0.100
 Commit:    5044b93829

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.100/

Host (useful for support):
  Version: 5.0.0
  Commit:  cf258a14b7

.NET SDKs installed:
  5.0.100 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Seems to be the same generator problem described in 1384 and 1385.
There is a temporary solution (downgrading net core sdk to 3.1.302 and aspnet-codegenerator to 3.1.3) until this is issue is really fixed.

I have the same problem on Ubuntu 20.04 with
-CodeGeneration.Design 5.0
-.NET SDK 5.0.1
trying to scaffold controller -api.

Same here elementary os and dotnet 5.0.1 :/ getting:

$ dotnet-aspnet-codegenerator razorpage -h

...

No code generator found with the name 'razorpage'.

No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.

Event after installing it.

I have tried again within a docker container, here is the Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:5.0
RUN dotnet tool install -g dotnet-aspnet-codegenerator
ENV PATH="${PATH}:/root/.dotnet/tools"

WORKDIR /app

COPY TestMvc.csproj .
RUN dotnet restore
COPY . .

CMD dotnet watch run

After starting the container I attach a shell and tried to run these commands without succes:

root@72923d3215d1:/app# dotnet aspnet-codegenerator -h


Usage: aspnet-codegenerator [arguments] [options]

Arguments:
  generator  Name of the generator. Check available generators below.

Options:
  -p|--project             Path to .csproj file in the project.
  -n|--nuget-package-dir   
  -c|--configuration       Configuration for the project (Possible values: Debug/ Release)
  -tfm|--target-framework  Target Framework to use. (Short folder name of the tfm. eg. net46)
  -b|--build-base-path     
  --no-build               

No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.

RunTime 00:00:01.22
root@72923d3215d1:/app# dotnet aspnet-codegenerator controller -name TestController
Building project ...
Finding the generator 'controller'...
Running the generator 'controller'...
A file matching the name EmptyController.cshtml was not found within any of the folders: 
   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:04.13

TestMvc.csproj:

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

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.0" />
  </ItemGroup>

</Project>

I have the same problem using Ubuntu 18.04 and net5.0

I just upgraded to the latest version of the sdk that was released two days ago.
Info:

.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  5.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Also updated the codegenerator tool, but I still can't schaffold anything...

I just upgraded to the latest version of the sdk that was released two days ago.
Info:

.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  5.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

Also updated the codegenerator tool, but I still can't schaffold anything...

Same here. .NET 5 for Linux seems to be broken. And it's the recommended one to use. I can attest that it works under Windows though. So it appears from this thread it's been broken since 3.1.4. That's concerning for those of us that use Linux to develop under.

The problem is that ProjectContextWriter creates package paths by combining a base directory (~/.nuget/packages), the package name, and the package version. The package name is written with Capitalized.Words, but the directories inside .nuget/packages are lowercase. This would work on a case-insensitive filesystem (and apparently it does work on Windows), but on a case-sensitive filesystem ProjectContextWriter sees that the path it just made doesn't exist and puts an empty string in its place.

A quick workaround is to convert the package name to lower case before using it as a part of the path, but this is probably not the right way to fix this. (?)

Since @mwdmwd was able to find the root cause for the problem, I was successful with the following workaround (using Ubuntu 18.04 and .NET 5.0):

Create a dummy vfat filesystem:

dd if=/dev/zero of=/tmp/mynuget bs=1024k count=2000
mkfs.vfat /tmp/mynuget

Mount it in place of your nuget directory:

sudo mount -o uid=myuser,gid=myuser -t vfat /tmp/mynuget /home/myuser/.nuget

Then, after running dotnet restore the scaffolding works as expected.

Since @mwdmwd was able to find the root cause for the problem, I was successful with the following workaround (using Ubuntu 18.04 and .NET 5.0):

Create a dummy vfat filesystem:

dd if=/dev/zero of=/tmp/mynuget bs=1024k count=2000
mkfs.vfat /tmp/mynuget

Mount it in place of your nuget directory:

sudo mount -o uid=myuser,gid=myuser -t vfat /tmp/mynuget /home/myuser/.nuget

Then, after running dotnet restore the scaffolding works as expected.

Thank's a lot! I stumbled (again) on this problem, and you just solved it 1 hour before I started looking if anyone did something new here :D

Just for anyone informatuon, @mtausig solution work's perfectly fine on Manjaro.

➜  App git:(auth) ✗ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  5.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

@edit

There is other issue though. Project just cannot compile in memory. I get a lot of issues with Razor pages overriding life-cycle methods...

@deepchoudhery any news on documentation for compiling this project?

@cezarlamann. Use the global_install.cmd/global_install.sh to build, and install the newly built package as a global tool.
Modify the VERSION variable to avoid confusion with release versions of the tool. Use something similar to this script to use the newly built nuget package in your new dotnet project for testing.

Let me know if you have more questions/concerns.

I saw there was an update to DotNet 5 that apt picked up, but the problem still persists. I know it was stated it works on Mac but isn't MacOS based on Linux? I would think the same issue would persist there. I can understand why it works under Windows, but I would think it would fail on both Linux and Mac. Any eta yet on an actual fix rather than the work arounds here? At least the creation of a vfat image and mounting it to ~/.nuget still works but would be nice to have to not use any workarounds.

Here's what I have on Ubuntu 20.04:

Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96

.NET SDKs installed:
5.0.102 [/usr/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Thanks for all the hard work you do and stay safe!

Since @mwdmwd was able to find the root cause for the problem, I was successful with the following workaround (using Ubuntu 18.04 and .NET 5.0):
Create a dummy vfat filesystem:

dd if=/dev/zero of=/tmp/mynuget bs=1024k count=2000
mkfs.vfat /tmp/mynuget

Mount it in place of your nuget directory:

sudo mount -o uid=myuser,gid=myuser -t vfat /tmp/mynuget /home/myuser/.nuget

Then, after running dotnet restore the scaffolding works as expected.

Thank's a lot! I stumbled (again) on this problem, and you just solved it 1 hour before I started looking if anyone did something new here :D

Just for anyone informatuon, @mtausig solution work's perfectly fine on Manjaro.

➜  App git:(auth) ✗ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  5.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

@edit

There is other issue though. Project just cannot compile in memory. I get a lot of issues with Razor pages overriding life-cycle methods...

For me, I love doing development using the Ubuntu WSL under Windows 10 since you can launch code from the WSL command line. I tried this but it didn't work. But the same thing can be accomplished by just using your already mounted hard drives where

Since @mwdmwd was able to find the root cause for the problem, I was successful with the following workaround (using Ubuntu 18.04 and .NET 5.0):
Create a dummy vfat filesystem:

dd if=/dev/zero of=/tmp/mynuget bs=1024k count=2000
mkfs.vfat /tmp/mynuget

Mount it in place of your nuget directory:

sudo mount -o uid=myuser,gid=myuser -t vfat /tmp/mynuget /home/myuser/.nuget

Then, after running dotnet restore the scaffolding works as expected.

Thank's a lot! I stumbled (again) on this problem, and you just solved it 1 hour before I started looking if anyone did something new here :D

Just for anyone informatuon, @mtausig solution work's perfectly fine on Manjaro.

➜  App git:(auth) ✗ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.101
 Commit:    d05174dc5a

Runtime Environment:
 OS Name:     manjaro
 OS Version:  
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.101/

Host (useful for support):
  Version: 5.0.1
  Commit:  b02e13abab

.NET SDKs installed:
  5.0.101 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

@edit

There is other issue though. Project just cannot compile in memory. I get a lot of issues with Razor pages overriding life-cycle methods...

I like doing development under Ubuntu so this worked great for my Ubuntu VM I run. But I also like to use the Windows 10 Ubuntu WSL. It's even easier under WSL.

  1. Create a directory on one of your Windows hard drives from WSL.

    cd /mnt/d
    mkdir nuget
    
  2. From your home directory in WSL, do the following:

    ln -s /mnt/d/nuget ~/.nuget
    

After that, it should work. The first time I did the scaffolding, it barked an error about the scaffolding failing. I tried the command again and then it worked.

So that's another work around for anyone using WSL to do their development.

I tried doing this on Mac OS as follows:

$ dd if=/dev/zero of=nugetfs bs=1024k count=20000
$ newfs_apfs -i nugetfs
$ hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount nugetfs
$ sudo mount -t apfs /dev/disk3s1 /Users/{user}/.nuget/

newfs_apfs -i creates a case-insensitive filesystem but when I run dotnet restore it still doesn't work.

Anyone got it working on Mac OS?

I had this exact same issues running MacOS on. I was able to resolve the issue using the suggested work around. I created a global json to target .net sdk 3.1 ( dotnet new globaljson --sdk-version 3.1.101 )

netcoreapp3.1







NET SDK (reflecting any global.json):
Version: 5.0.102
Commit: 71365b4d42

Runtime Environment:
OS Name: Mac OS X
OS Version: 11.0
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/5.0.102/

Host (useful for support):
Version: 5.0.2
Commit: cb5f173b96

.NET SDKs installed:
1.0.0-preview2-003121 [/usr/local/share/dotnet/sdk]
2.0.3 [/usr/local/share/dotnet/sdk]
2.1.4 [/usr/local/share/dotnet/sdk]
2.1.302 [/usr/local/share/dotnet/sdk]
2.1.505 [/usr/local/share/dotnet/sdk]
2.1.700 [/usr/local/share/dotnet/sdk]
3.0.100 [/usr/local/share/dotnet/sdk]
3.1.101 [/usr/local/share/dotnet/sdk]
3.1.102 [/usr/local/share/dotnet/sdk]
3.1.300 [/usr/local/share/dotnet/sdk]
3.1.301 [/usr/local/share/dotnet/sdk]
3.1.302 [/usr/local/share/dotnet/sdk]
3.1.403 [/usr/local/share/dotnet/sdk]
3.1.404 [/usr/local/share/dotnet/sdk]
3.1.405 [/usr/local/share/dotnet/sdk]
5.0.100 [/usr/local/share/dotnet/sdk]
5.0.101 [/usr/local/share/dotnet/sdk]
5.0.102 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.19 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.20 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

I tried doing this on Mac OS as follows:

$ dd if=/dev/zero of=nugetfs bs=1024k count=20000
$ newfs_apfs -i nugetfs
$ hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount nugetfs
$ sudo mount -t apfs /dev/disk3s1 /Users/{user}/.nuget/

newfs_apfs -i creates a case-insensitive filesystem but when I run dotnet restore it still doesn't work.

Anyone got it working on Mac OS?

I was able to resolve this by running dotnet new globaljson --sdk-version 3.1.101 in the project folder to target the 3.1 version of the generator

Hey all,
@rhaynes123 @jonathan-daniel @cezarlamann @sanjitn @mtausig @MadeleineRoberts-WellSky @gustavohrgomes @stephen-innotek @lctx @iBolski @KilianKilmister @NorbiPeti

I have a fix for this issue out with a new 3.1.5 and 5.0.2 package out.
Use dotnet tool update dotnet-aspnet-codegenerator -g --version 3.1.5/5.0.2 depending on if you are targeting .netcoreapp3.1 or net5.0. I would like it if someone could confirm the fix before I close the issue.

You will also need to update the Microsoft.VisualStudio.Web.CodeGeneration.Design package as well.

Apologize for the lengthy delay on this fix and appreciate all the feedback.

Hey all,
@rhaynes123 @jonathan-daniel @cezarlamann @sanjitn @mtausig @MadeleineRoberts-WellSky @gustavohrgomes @stephen-innotek @lctx @iBolski @KilianKilmister @NorbiPeti

I have a fix for this issue out with a new 3.1.5 and 5.0.2 package out.
Use dotnet tool update dotnet-aspnet-codegenerator -g --version 3.1.5/5.0.2 depending on if you are targeting .netcoreapp3.1 or net5.0. I would like it if someone could confirm the fix before I close the issue.

You will also need to update the Microsoft.VisualStudio.Web.CodeGeneration.Design package as well.

Apologize for the lengthy delay on this fix and appreciate all the feedback.

It works for me in WSL! Awesome job and thanks for looking into this. It is very much appreciated.

Hey all,
@rhaynes123 @jonathan-daniel @cezarlamann @sanjitn @mtausig @MadeleineRoberts-WellSky @gustavohrgomes @stephen-innotek @lctx @iBolski @KilianKilmister @NorbiPeti

I have a fix for this issue out with a new 3.1.5 and 5.0.2 package out.
Use dotnet tool update dotnet-aspnet-codegenerator -g --version 3.1.5/5.0.2 depending on if you are targeting .netcoreapp3.1 or net5.0. I would like it if someone could confirm the fix before I close the issue.

You will also need to update the Microsoft.VisualStudio.Web.CodeGeneration.Design package as well.

Apologize for the lengthy delay on this fix and appreciate all the feedback.

Works with ubuntu 20.04 !

dotnet aspnet-codegenerator identity -h

Usage: aspnet-codegenerator [arguments] [options]

Arguments:
  generator  Name of the generator. Check available generators below.

Options:
  -p|--project             Path to .csproj file in the project.
  -n|--nuget-package-dir
  -c|--configuration       Configuration for the project (Possible values: Debug/ Release)
  -tfm|--target-framework  Target Framework to use. (Short folder name of the tfm. eg. net46)
  -b|--build-base-path
  --no-build

Selected Code Generator: identity

Generator Options:
  --dbContext|-dc       : Name of the DbContext to use, or generate (if it does not exist).
  --files|-fi           : List of semicolon separated files to scaffold. Use the --listFiles option to see the available options.
  --listFiles|-lf       : Lists the files that can be scaffolded by using the '--files' option.
  --userClass|-u        : Name of the User class to generate.
  --useSqLite|-sqlite   : Flag to specify if DbContext should use SQLite instead of SQL Server.
  --force|-f            : Use this option to overwrite existing files.
  --useDefaultUI|-udui  : Use this option to setup identity and to use Default UI.
  --layout|-l           : Specify a custom layout file to use.
  --generateLayout|-gl  : Use this option to generate a new _Layout.cshtml
  --bootstrapVersion|-b : Specify the bootstrap version. Valid values: '3', '4'. Default is 4.
dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.103
 Commit:    9effbc8ad5

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.103/

Host (useful for support):
  Version: 5.0.3
  Commit:  eae88cc11b

.NET SDKs installed:
  5.0.103 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 5.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 5.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

It works for me, thank you.
Ubuntu 16.04 net 5.0.3

It works on Ubuntu 20.04 and .NET Core 3.1 as well, thanks.

Hey all,
@rhaynes123 @jonathan-daniel @cezarlamann @sanjitn @mtausig @MadeleineRoberts-WellSky @gustavohrgomes @stephen-innotek @lctx @iBolski @KilianKilmister @NorbiPeti

I have a fix for this issue out with a new 3.1.5 and 5.0.2 package out.
Use dotnet tool update dotnet-aspnet-codegenerator -g --version 3.1.5/5.0.2 depending on if you are targeting .netcoreapp3.1 or net5.0. I would like it if someone could confirm the fix before I close the issue.

You will also need to update the Microsoft.VisualStudio.Web.CodeGeneration.Design package as well.

Apologize for the lengthy delay on this fix and appreciate all the feedback.

I'll give it a try this weekend and post results here. Thank you @deepchoudhery

I still have the same issue on Win10 VS2019 (16.8.5):

 dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.103
 Commit:    72dec52dbd

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19041
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\5.0.103\

Host (useful for support):
  Version: 5.0.3
  Commit:  c636bbdc8a

.NET SDKs installed:
  2.1.202 [C:\Program Files\dotnet\sdk]
  2.1.509 [C:\Program Files\dotnet\sdk]
  2.1.513 [C:\Program Files\dotnet\sdk]
  2.1.805 [C:\Program Files\dotnet\sdk]
  2.2.109 [C:\Program Files\dotnet\sdk]
  3.1.100 [C:\Program Files\dotnet\sdk]
  5.0.102 [C:\Program Files\dotnet\sdk]
  5.0.103 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
    <UserSecretsId>aspnet-GreenEdge.Web-642EB634-0E6C-41E6-83FB-A0E080BE11EE</UserSecretsId>
    <CopyRefAssembliesToPublishDirectory>false</CopyRefAssembliesToPublishDirectory>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.3" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.3" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="5.0.3" />
    <PackageReference Include="Microsoft.Identity.Web" Version="1.6.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\GreenEdge.Model\GreenEdge.Model.csproj" />
  </ItemGroup>

</Project>

To reproduce

  1. Right-click project => Add => new Scaffoled Item => Identity => Add
  2. Select Account/Login + Data context class => Add
    image

If I downgrade teh project to ,Net Core 3.1 and downgrade all ef packages and Microsoft.VisualStudio.Web.CodeGeneration.Design to 3.1.11 it works.

I hit same issue just now. I believe that the problem is that the Microsoft.VisualStudio.Web.CodeGeneration.Design is 5.0.2 the highest and the version mismatch fails the scaffolding process.

In Pop OS 20.04 I solved this with sdk and aspnet-codegenerator downgrade
sudo apt install dotnet-sdk-3.1=3.1.301-1
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
This is my dotnet --info
`SDK de .NET Core (reflejando cualquier global.json):
Version: 3.1.301
Commit: 7feb845744

Entorno de tiempo de ejecución:
OS Name: pop
OS Version: 20.04
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.301/

Host (useful for support):
Version: 3.1.8
Commit: 9c1330dedd

.NET Core SDKs installed:
3.1.301 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
`

This worked for me in linux mint 20 !!!

@deepchoudhery Works for me, thanks!
ubuntu 20.04.2
dotnet 5.0.103

Closing. Thanks all.

if your solution contains multiple projects, add this reference in the project with the data model as well

Was this page helpful?
0 / 5 - 0 ratings