NuGet command line has been stopped working - asp.net

i cant built a solution, and this errors occurs ,
the error window is given below. how can i solve this error.enter image description here

This error usually happen when one or more file that you used in your nuget in current project is missing or corrupted.
Try Restoring :
Tools > NuGet Package Manager > Package Manager Console command.
Type Update-Package -Reinstall
or
Update-Package -Reinstall -ProjectName myProj

Usually it happens when you do multiple task simultaneously in the IDE.
At the status bar , it says rebuild are started...
Another problem is with your nuget command-line console ,
you need to enter the command after u see the PM> at the console , while your command is 'INSTRUCTION'

I installed .Net framework 4.5 it is working for me

Related

New project xamarin.form prism Error NETSDK1004 - Prism 2.2.1

when generating a new project xamarin.form prism I get this error when running. With the previous version 2.1.7 it worked for me OK.
It does not allow me to open the Nuget Package since it also gives an error.
Any recommendation?
I saw the 2 posts of this error but they do not apply to me.
Error NETSDK1004 Assets file 'C:\Empresas\Job_Facu\Job\Job.Prism\Job.Prism\obj\project.assets.json' not found. Run a NuGet package restore to generate this file. Job.Prism C:\Program Files\dotnet\sdk\3.1.202\Sdks\Microsoft.NET.Sdk\targets\Microsoft.PackageDependencyResolution.targets 234
The error tells you what to do. Run a NuGet restore. Visual Studio should help you do this automatically. Note that if this occurred after updating dependencies sometimes Visual Studio gets confused and it's best to close Visual Studio and reopen it. This usually gets it to refresh itself so you get the updated package restore.
If that's not working for you, you can download the latest nuget.exe and from the command line navigate to the solution directory and execute the command {path to nuget.exe} restore.
When NuGet performs a restore it generates the project.assets.json file in the obj folder of each project it has restored. This in turn provides MSBuild with the reference information it needs to properly reference your dependencies like Prism and Xamarin.Forms.
I have recently ran into similar issue as well, seemingly out of the blue. I believe upgrading my build machine to the latest VS version (VS for Mac 8.10.4 (build 11))
NETSDK1004: */project.assets.json' not found. Run a NuGet package restore to generate this file.
To fix, I had to run Nuget Restore twice. Once for the shared project directory and once for the iOS project.
If I run the restore just for the Shared/(main.sln file) project directory I get the error.
If I run the restore for the iOS project the build passes but IPA file isn't created.
Need to run both.
Modules used for CI/CD build in Azure Devops Pipeline

Error "dotnet : Could not find any project in `C:\**." when running "dotnet add package Microsoft.AspNetCore.Authentication.MicrosoftAccount"

I have visual studio 2019 and i created a new asp.net core 2.2 project. now i am following these steps Configure Microsoft Account Authentication to enable external login to our web application. but when i run this command:-
dotnet add package
Microsoft.AspNetCore.Authentication.MicrosoftAccount
i got this error:-
PM> dotnet add package
Microsoft.AspNetCore.Authentication.MicrosoftAccount dotnet : Could
not find any project in C:\Users\*****\source\repos\MSlogintest\. At
line:1 char:1
+ dotnet add package Microsoft.AspNetCore.Authentication.MicrosoftAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Could not find ...\MSlogintest`.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError Usage: dotnet add package [options]
Arguments: The project file to operate on. If a
file is not specified, the command will search the current directory
for one. The package reference to add.
Options: -h, --help Show command line help.
-v, --version The version of the package to add. -f, --framework Add the reference only when targeting a specific framework. -n, --no-restore
Add the reference without performing restore preview and compatibility
check. -s, --source The NuGet package source
to use during the restore. --package-directory The
directory to restore packages to. --interactive
Allows the command to stop and wait for user input or action (for
example to complete authentication).
as follow:-
and when i access the folder, i found that there is a VS project folders, as follow:-
so why the error is saying that it can not find any project?
can anyone advice on this error please?
Thanks
I encountered the same issue and found the fix. First of all, read the error message completely and carefully. It says:
"Could not find any project ...."
Which means it was expecting the project information. If you further watch the message closely, it has mentioned the correct usage of this command i.e.
Usage: dotnet add <PROJECT> package [options] <PACKAGE_NAME>
In the argument, enter your project name and run it again. This time, you should see the success message similar to:
info : Adding PackageReference for package 'Microsoft.xxxxxxxx.xxxxxxxx' into project 'C:\Users\xxx\source\repos\ProjectFolder\xxxxxxxx.csproj'.
Got this working on powershell (no IDE). The solution was somewhere hidden in the comments but here is the easy one:
dotnet add <project> package <packageName>
In this case I believe it would be:
dotnet add ContosoUniversity package Microsoft.AspNetCore.Authentication.MicrosoftAccount
cd into the particular project you want to add the package to and type your dotnet command again
> cd project Directory
> dotnet add package Microsoft.AspNetCore.Authentication.MicrosoftAccount
Had the same problem, when i was fiddling around with the nuget commandline it at some point proposed i should retry with elevated privileges.
Specifically i tried manually pointing it one level deeper in the folder structure. (As suggested by DavidG)
I thought: okay, weird, but i am out of good ideas, so lets try that one.
Restarted as administrator, worked.
And by it worked i mean it just worked, no manual fiddling involved. I just used the graphical package manager option that just somehow became available.
So my best guess is i somehow messed up something when installing visual studio. Because i already tried just creating a new project.
Nuget option as admin
You may be clicking on the wrong tab on the nuget site. Make sure you select Package Manager tab. The error you get happens when you click on the .net cli tab and use it in the package manager console window.
Try this in your command terminal, you should into a directory project:
dotnet add package <package.name>
This command is for .NET core. I used it for an old project because it's the first one shown on nuget.org.
The old command should be like this:
Install-Package [package name]

Couldn't install any packages .Net Framework NuGet

I have a solution with a lot of projects targeting .net framework but not any with .core NuGet. The case is that, quite occasionally I started getting the following error while trying to set up any package from manage NuGet packages
HRESULT E_FAIL has been returned from a call to a COM component
Did someone run into the same issue and how you managed to resolve it
Go to your C:\Users\{USER}\AppData\Roaming\Microsoft\VisualStudio folder, and you should find a folder in there called 15_{id}. Open it, and have a look at the ActivityLog.xml. If you have a look in it you should find the error in there and the library that's causing it. In my case it was caused by Microsoft.visualstudio.shell.interop.IVsReferenceManager2 within the Microsoft.VisualStudio.Shell.Interop.11.0.dll library.
This post helped me solve the issue then: Msdn forum
1.Open "Developer Command Prompt for VS 2017" as Admin
2.CD into "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\PublicAssemblies"
3.Run "gacutil -i Microsoft.VisualStudio.Shell.Interop.11.0.dll"
After a restart, it all worked well.
Please Follow the Source
referencemanagerpackage-fails-to-install-vs-2017-community-edition

The term 'Add-migration' is not recognized - VS2017 and EntityFrameworkCore

I am posting this question just in case the solution I found would help someone else out. While working in Visual Studio 2017 rc4 each time I tried to run the Add-Migration command in the Package Manager console I get the following error:
The term 'Add-migration' is not recognized...
The solution that worked for me after trying a whole raft of other solutions posted, was to:
right click on my project
select Manage Nuget Packages
select the browse tab
thick Include prerelease check box
install the Microsoft.EntityFrameworkCore.Tools
N.b that aspnetcore project in visual studio 2017 do not seem to have the project.json file.
You just need to initialize the powershell module. I believe this is a bug, but it's pretty easy to work around. All you need to do is find the init.ps1 file and dot source it.
Just type this into the package manager console:
C:\Users\YourUserAccount\.nuget\packages\Microsoft.EntityFrameworkCore.Tools\1.1.0-preview4-final\tools\init.ps1
Now the version might be different for you, depending on which one you have installed. Make sure you dot source the same version that is in your project.
Hi There
This is almost an normal problem in Microsoft, and they pointing out the same solution:
Microsoft Docs - Getting Started with EF Core on ASP.NET Core with a New database
For me above dosn't solve my problem, but this line first does:
PM> Install-Package Microsoft.EntityFrameworkCore.Tools
PM> add-migration InitialCreate
/Cheers, Jan
Make sure that the Microsoft.EntityFrameworkCore.Tools package is installed. If it's not, then add it from NuGet or simply type the following in the Package Manager Console:
Install-Package Microsoft.EntityFrameworkCore.Tools
Installing the above package worked for me.
If your are using VS 2019 and Dot.net core version 3.1
Just install the : Microsoft.EntityFrameworkCore.Tools from Manage NuGet Packages
this solved my problem.
I have had the same problem with a project created with VS2017 version 15.9.4 and .Net Core 2.1.
I have fixed it by adding Microsoft.EntityFrameworkCore.Tools to dependences of my project.
On project select Manage Nuget Packages
Browse and Search Microsoft.EntityFrameworkCore.Tools
Install it on your project
Then you can open Package Manager Console and use commands :
Add-Migration
Drop-Database
Get-DbContext
Scaffold-DbContext
Script-Migrations
Update-Database
Regards
dcube
Download the latest .net Core 2.0 from the link below and it will fix your issue:
https://www.microsoft.com/net/core#windowscmd
I reinstalled package Microsoft.EntityFrameworkCore.Tools and issue got fixed for me.
It works for me.
Close all VIsual Studio instances.
Open VS.
Open Package Manager console, let it be initialized.
Now open the project and try Add-Migration.
For me, I had to copy the folder microsoft.entityframeworkcore.tools from
C:\Program Files\dotnet\sdk\NuGetFallbackFolder
To
C:\Users\<user>\.nuget\packages
You have to add this to your CSPROJ file. This will most likely be fixed when the Core 2.0 is released. This stems from an issue where you can not install this package Microsoft.EntityFrameworkCore.Tools.DotNet using the NUGET tools due to version requirements.
Then using CMD/PowerTools in the project directory you can issue the following commands:
dotnet ef migrations add InitialCreate
dotnet ef database update
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.1" />
</ItemGroup>
I had the issue with VS2019 Enterprise on a .NET MVC 5 project with EF6.3.0. I was pulling my hair out and crushed for time. I was trying everything. In desperation, here's what I did that finally worked, FWIW.
Open VS2019
Let it completely finish all background processes on load (lower
left-hand corner animated icon)
Close Package Manager Console
Right-click Project, select "Manage NuGet Packages"
Check "Include Pre-Release"
Choose "Browse" Tab Update EntityFramework to V6.4.0-preview2-19525-03
Close VS2019 Open VS2019 Select from Menu:
Tools > Nuget Package Manager > Package Manager Console which opens
the PM console
At THIS point, FINALLY, add-migration "MyReferencePoint" worked!
Hope this helps someone.
we get the same error when "add-migration", i try one solution which is update Package Manager by using follow step
In Visual Studio, from the "Tools" menu choose the "Extensions and Updates" option.
From the dialog that appears, expand the "Updates" node from the tree at the left side.
Select the "Visual Studio Gallery" option from the tree.
Finally, look for the Package Manager update in the list of updates at the right side of the dialog and click the "Update" button beside it.
it is approx 5 - 10 MB update, after update complete try Get-Help Add-Migration

The command "nuget pack..." exited with code 1

I'm' trying to execute a post build event that builds a nuget package based on a .nuspec file. I'm using Visual Studio 2013. My post build event command line is:
nuget pack $(ProjectPath) -Symbols -Properties Configuration=$(ConfigurationName) -IncludeReferencedProjects
When I build my project, I get the following error:
The command "nuget pack C:\Users\user\Documebts\Code\BookProject\BookProject.Nuget\
BookProject.Nuget.csproj -Symbols -Properties Configuration=Debug
-IncludeReferencedProjects" exited with code 1.
I'm not sure what's going on - I changed the Visual Studio build output to Diagnostic and found this:
>Using 'BookProject.nuspec' for metadata. (TaskId:44)
>Access to the path 'C:\BookProject.1.0.3.4.nupkg' is denied. (TaskId:44)
>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(4714,5): error MSB3073: The command "nuget pack C:\Users\user\Documebts\Code\BookProject\BookProject.Nuget\ BookProject.Nuget.csproj -Symbols -Properties Configuration=Debug -IncludeReferencedProjects" exited with code 1.
>Done executing task "Exec" -- FAILED. (TaskId:44)
>Done building target "PostBuildEvent" in project "Miw.Mshdf.Net.Nuget.csproj" -- FAILED.: (TargetId:72)
If I open up a command prompt and type in the post build event command, it works fine and builds the nuget package without any problems. Any ideas?
According to the error code, your problem should be related to the access permission for the path "C:\". Please run your Visual Studio as administrator to make sure it has enough permissions to do any operations.
And make sure your current Windows user also has enough permissions to access the "C:\".
The work around i used is
1. Right click on solution -> manage nuget package for solution
2. On top there is text "install missing packages" -> click restore
3. Also i manually given the package sources in -tools ->Nuget package manager ->
package sources
4. run VS 2013 in administrator mode and gave permission to the required folders

Resources