Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 784 Vote(s) - 3.51 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error "dotnet : Could not find any project in `C:\**." when running "dotnet add package Microsoft.AspNetCore.Authentication.MicrosoftAccount"

#1
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][1] 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 <PROJECT> package [options] <PACKAGE_NAME>
>
> Arguments: <PROJECT> The project file to operate on. If a
> file is not specified, the command will search the current directory
> for one. <PACKAGE_NAME> The package reference to add.
>
> Options: -h, --help Show command line help.
> -v, --version <VERSION> The version of the package to add. -f, --framework <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 <SOURCE> The NuGet package source
> to use during the restore. --package-directory <PACKAGE_DIR> 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:-
[![enter image description here][2]][2]

and when i access the folder, i found that there is a VS project folders, as follow:-
[![enter image description here][3]][3]

so why the error is saying that it can not find any project?
can anyone advice on this error please?
Thanks


[1]:

[To see links please register here]

[2]:

[3]:
Reply

#2
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 <PROJECT> 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'.

[![demonstration of the error and the fix][1]][1]


[1]:
Reply

#3
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][1]

[1]:
Reply

#4
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.
Reply

#5
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`
Reply

#6
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
Reply

#7
Try this in your command terminal, you should into a directory project:

dotnet add <project> package <package.name>
Reply

#8
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]
```
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through