aspnet-codegenerator: No code generators available, Even after adding Microsoft.VisualStudio.Web.CodeGeneration.Design - asp.net-core

Unable to generate scaffolding using aspnet-codegenerator, below is what I tried:
Created an ASP.Net RazorPages application using
dotnet new webapp
Did a dotnet build
Installed dotnet-aspnet-codegenerator using
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4
Ran dotnet aspnet-codegenerator --help
It says: No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
Added the package mentioned in step 4 using
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
Package added is:
<ItemGroup> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" /> </ItemGroup>
Again ran: dotnet build
Final-Step
Ran dotnet aspnet-codegenerator --help
Again it says: No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
.Net core installed version: 3.1.401
Os: Ubuntu 20.04

This is already a few month old, but I ran into it recently for all my projects.
In case someone else lands on this page, the solution in my case(MAC OS), was to uninstall and reinstall dotnet-aspnet-codegenerator.
Run in terminal:
dotnet tool uninstall --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4

I have same problem when upgrade from .net core 3.1.4 to 5.0.1.
My solution:
update global tools:
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet tool update --global dotnet-aspnet-codegenerator
dotnet tool install --global dotnet-ef
dotnet tool update --global dotnet-ef
add/update links to packages
dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.EntityFrameworkCore.Design
Replace string netcoreapp3.1.4 to net5.0 in .csproj and launch.json files
Clear directories
bin
obj
Rebuild project
Finally run:
dotnet aspnet-codegenerator --help
If all fine it will show available generators.

The root cause of this problem has been described in this issue as the .NET code expecting a case-insensitive filesystem which fails on a Linux host.
A suggested workaround would be to temporarily mount you ~/.nuget directory on a vfat filesystem.
To do so create a dummy file holding the filesystem
dd if=/dev/zero of=/tmp/mynuget bs=1024k count=2000
mkfs.vfat /tmp/mynuget
and then mount it
sudo mount -o uid=myuser,gid=myuser -t vfat /tmp/mynuget /home/myuser/.nuget
and use it
dotnet restore
dotnet aspnet-codegenerator ...

I test your command,and when I do this dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.4,I can get
and then Ran dotnet aspnet-codegenerator --help,I get the same message No code generators are available in this project.Add Microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet with you,
but when I do the following,I can run without the message:
I think maybe the package is not added correctly,you can try to remove and add it again.
dotnet remove package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design

I have found the SOLUTION to this issue:
The newest versions are giving some problems, so you will have to downgrade the version of the sdk to the 3.1.3 by writing this command on the terminal:
sudo apt install dotnet-sdk-3.1=3.1.301-1
After that you will need to install the following:
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
After that you will need to add the right Web.CodeGeneration.Design Package by writing this on the terminal:
sudo apt install dotnet-sdk-3.1=3.1.301-1
dotnet tool install --global dotnet-aspnet-codegenerator --version 3.1.3
That has worked for me!!

Related

Run "dotnet tool restore" to make the "dotnet-ef" command available

I have try to find solution for this can some help please.
This command will install latest version of dotnet-ef.
dotnet tool install --global dotnet-ef
If still not working, you could try install the right version like v3.1.1
dotnet tool install --global dotnet-ef --version 3.1.1
You could try uninstall before install new one
dotnet tool uninstall --global dotnet-ef
Add nuget package when finish install,
dotnet add package Microsoft.EntityFrameworkCore.Design
After doing all the above, issue is still same
Step 1:
Go to the folder where your .sln file is.
Step 2:
Create a folder called .config. And create a file inside it named: dotnet-tools.json
Add the following content in it and save it:
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.8",
"commands": [
"dotnet-ef"
]
}
}
}
Step 3:
Go to your .sln folder, open cmd window and run:
dotnet tool restore
Alternate Way:
Step 1:
Create manifest as outlined in this tutorial:
https://learn.microsoft.com/en-us/dotnet/core/tools/local-tools-how-to-use
Step 2:
Install ef as local tool:
dotnet tool install dotnet-ef
Step 3:
Restore your packages
dotnet tool restore

How to uninstall dotnetcli from command line

Im using the formula described here (https://learn.microsoft.com/en-us/dotnet/core/versions/remove-runtime-sdk-versions?tabs=macos) to uninstall dotnet core sdk from macos. I followed the steps and after finishing and verifying there is not an sdk nor a runtime, the command dotnet is still valid in the terminal and is referring that is valid at hosting. Any ideas around how to remove all the sdk, cli from my laptop?
If you want to remove all versions and components of .NET Core, just delete the main dotnet directory:
sudo rm -rf /usr/local/share/dotnet

cant Install [.net core] packages using visual studio code(dotnet cli)

I using the latest asp core 3.1 framework. I am trying to setup my database but there is an issue. I can't seem to install the following packages
dotnet tool install --global dotnet-ef
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet add package Microsoft.EntityFrameworkCore.SQLite
dotnet add package Microsoft.VisualStudio.Web.CodeGeneration.Design
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
I get the following errors. will appreciate it if any one can help with
a solution.
error NU1100: Unable to resolve 'dotnet-aspnet-codegenerator ' for '.NETCoreApp,Version=v3.1'.
error NU1100: Unable to resolve 'dotnet-aspnet-codegenerator ' for '.NETCoreApp,Version=v3.1/any'.
The tool package could not be restored.
Tool 'dotnet-aspnet-codegenerator' failed to install. This failure may have been caused by:
You are attempting to install a preview release and did not use the --version option to specify the version.
A package by this name was found, but it was not a .NET Core tool.
The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
You mistyped the name of the tool.
This happens when I try to install any of the packages.

Verdaccio Installing on IIS server: Can not find iisnode-verdaccio on npmjs

I no longer find iisnode-verdaccio on npmjs when following the instructions of Installing on IIS for Verdaccio. Any ideas?
for install the verdaccio on iis. follow this stages:
install node.js. (e.g: version 12.14.0)
install python with powersell.
run this command
npm i -g --production windows-build-tools
then run
npm i -g node-gyp
Get the Python.exe file path.
default path: C:\Users\xxx\.windows-build-tools\python27\python.exe
Add a new Environment Variable with name PYTHON and value: C:\Users\xxx\windows-build-tools\python27.
if visual studio is installed go to next stage. else install Descktop development with c++ from vs setup.
install verdaccio (e.g: version 4.4.0)
npm i -g verdaccio#4.4.0
install iisnode (e.g: version 0.2.21).
install ApplicationRequestRouting (e.g: v3.0).
copy web.config , package.json, start.js from this
finaly, reset iis and enjoy.
more info
I hope is useful.

Moonmail installation issue - Command "project" not found

I'm initializing Moonmail and following the readme, executing the following command:
sls project init -c -n your-lower-case-project-name
I'm getting the following:
Command "project" not found, Run "serverless help" for...
It seems that Serverless no longer has the "project" command (since version 0.5) and it has been replaced with "service" (which works a little differently).
What would be the way forward here?
Although they say that Moonmail supports version 0.5.2 or higher, it's not true. You need to use version 0.5x of the Serverless Framework and you can't use any version 1.x because 1.x is a complete rewrite.
Unfortunately, the solution is to uninstall the current Serverless Framework and install an old version.
npm -g uninstall serverless
npm -g install serverless#0.5.6