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]
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
I created a MVC 6 project with RC1 and added reference to "Microsoft.Data.SqlXml" with no problem. When I migrated to RC2, I can not add the reference to "Microsoft.Data.SqlXml". I get an error message ".Net Core projects only support referencing .NET framework assemblies in this release. To reference other assemblies, they need to be included in a NuGet package and reference that package." Is there a easy way I can add the reference?
I'm finally able to add the reference "Microsoft.Data.SqlXml" by creating NuGet package, to the project migrated to RC2.
Publish RC1 project to file system and find out the package folder "Microsoft.Data.SqlXml" under "PublishOutput"
Download Nuget Package Explorer and open the .nuspec file in "Microsoft.Data.SqlXml" package folder.
Edit the files .nuspec, project.json, project.lock.json in Nuget Package Explorer, change all words "DNX" -> ".NETFramework", and "Save As" package file Microsoft.Data.SqlXml.nupkg.
In VS 2015, Tools -> NuGet Package Manager -> Setting, add local folder to package source list, then copy the .nupkg file to the folder
Install the Microsoft.Data.SqlXml NuGet package from the local source
I don't know why MS made the thing so complicated, 2 seconds work in RC1 but took me one day to figure it out in RC2.
We (me and three other people) will make an ASP.NET MVC application and use GitHub for version control. We've added some NuGet packages like Unity.MVC5.
Person one has commit and sync the project to the master branch. He's got no problems. The other three people sync the branch but they got problems with the NuGet libaries. See errors below:
Error: This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props.
Error: Metadata file D:\...\MarkeOnlineWebsite\MarkeOnline.Website\bin\MarkeOnline.Website.dll could not be found
Warning: The referenced component ... could not be found.
Update: I've also added this .gitignore file.
How could we solve this problem?
I'm playing with new Core CLR code and trying to implement some test project. I found that Moq at the current moment not support Core CLR and there is package from MS guys called moq.netcore. But when I'm adding this in my list of dependacies like moq.netcore": "4.4.0-beta8" I get this error:
Unable to locate Dependency moq.netcore >= 4.4.0-beta8
How to fix this?
You need to add special source to your nuget package manager to be able to locate dev version of packages by MS team.
URL of sources where you could find this packet is https://www.myget.org/F/aspnet-contrib/api/v3/index.json
if you prefer command line I think this command should work:
nuget sources add -name FeedName -Source https://www.myget.org/F/aspnet-contrib/api/v3/index.json
or click to nugget settings in Visual Studio and add it manually (you could check there for example)