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
Related
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!!
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.
I imported MVC template by running dotnet new mvc -lang C#. I got default template here but I noticed it's missing package.json file.
How can I add package.json in VSCode editor to this template to add other required references ?.
You can use npm init command from node package manager.
Open Nodejs command prompt.
Navigate to project directory.
type npm init command.
Specify basic details like name, version, description, entry point etc.
This will create basic of package.json. Then, you can use npm install <package> --save to install new npm packages in your project.
Other option is, you can create package.json manually.
I've added the following into my package.json file:
"dependencies": {
"linter": "1.11.4"
}
But how do I actually get this dependency installed?
After you have updated your packages.json and saved the file you can install the dependencies by running Update Package Dependencies: Update:
Press Ctrl-Shift-P to open the Command Palette.
Type updu which should select Update Package Dependencies: Update
Press Enter
If you are going to be doing a lot of this you can take it a step further and add a keybinding:
'atom-workspace':
'ctrl-alt-shift-u': 'update-package-dependencies:update'
You install your package then Atom/npm take care of installing the dependencies.
https://discuss.atom.io/t/load-developing-package/2554/4
When you start Atom it loads packages from various directories. When you open it in developer mode it loads additional packages from ~/.atom/dev/packages, so the first thing to do is to move/symlink your package to that directory.
Then you can go to your new package directory and run atom -d . to create a new atom window in developer mode and automatically add your package as a project directory.
Then you can run apm install to update your dependencies.
Hi I'm trying to install Grunt on Windows 7 64 bit. I have installed Grunt using commands
npm install -g grunt
npm install -g grunt-cli
but now if I try to do grunt init, it is throwing me an error -
A valid Gruntfile could not be found. Please see the getting started
guide for more information on how to configure grunt:
http://gruntjs.com/getting-started Fatal error: Unable to find
Gruntfile.
But when I look inside the grunt folder on my system the Gruntfile.js is there. can someone please guide me how to install this grunt properly and how to write built Script using the grunt. I have one HTML page and java script if i wants built a script using Grunt how can i do it?
To setup GruntJS build here is the steps:
Make sure you have setup your package.json or setup new one:
npm init
Install Grunt CLI as global:
npm install -g grunt-cli
Install Grunt in your local project:
npm install grunt --save-dev
Install any Grunt Module you may need in your build process. Just for sake of this sample I will add Concat module for combining files together:
npm install grunt-contrib-concat --save-dev
Now you need to setup your Gruntfile.js which will describe your build process. For this sample I just combine two JS files file1.js and file2.js in the js folder and generate app.js:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
concat: {
"options": { "separator": ";" },
"build": {
"src": ["js/file1.js", "js/file2.js"],
"dest": "js/app.js"
}
}
});
// Load required modules
grunt.loadNpmTasks('grunt-contrib-concat');
// Task definitions
grunt.registerTask('default', ['concat']);
};
Now you'll be ready to run your build process by following command:
grunt
I hope this give you an idea how to work with GruntJS build.
NOTE:
You can use grunt-init for creating Gruntfile.js if you want wizard-based creation instead of raw coding for step 5.
To do so, please follow these steps:
npm install -g grunt-init
git clone https://github.com/gruntjs/grunt-init-gruntfile.git ~/.grunt-init/gruntfile
grunt-init gruntfile
For Windows users: If you are using cmd.exe you need to change ~/.grunt-init/gruntfile to %USERPROFILE%\.grunt-init\. PowerShell will recognize the ~ correctly.
Some time we need to set PATH variable for WINDOWS
%USERPROFILE%\AppData\Roaming\npm
After that test with where grunt
Note: Do not forget to close the command prompt window and reopen it.
I got the same issue, but i solved it with changing my Grunt.js to Gruntfile.js
Check your file name before typing grunt.cmd on windows cmd (if you're using windows).
You should be installing grunt-cli to the devDependencies of the project and then running it via a script in your package.json. This way other developers that work on the project will all be using the same version of grunt and don't also have to install globally as part of the setup.
Install grunt-cli with npm i -D grunt-cli instead of installing it globally with -g.
//package.json
...
"scripts": {
"build": "grunt"
}
Then use npm run build to fire off grunt.