Installing Nuget Gets Dependencies Only - nuget

I have a .NET Framework 4.5 project. I'm trying to install Microsoft.NET.Test.Sdk. This should be possible as per https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/
I ran the following command, but get the dependencies only. I tried installing via the Nuget Package Manager too. Finally... I see the package inside my packages.config file, but don't see it in my references. Any suggestions?
Install-Package Microsoft.NET.Test.Sdk -Version 15.7.0

I ended up using Microsoft.VisualStudio.TestTools.UnitTesting.

Related

Need to Update EF Core Tools

When I use the dotnet ef tools in the VS 2017 Package Manager Console I get a warning message about needing to update EF Core tools:
PM> dotnet ef migrations list -s ../RideMonitorSite
The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.2-rtm-30932'. Update the tools for the latest features and bug fixes.
20180831043252_Initial
But my csproj file has this entry:
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.2" />
</ItemGroup>
I've confirmed that the version installed is, in fact, out of date:
PM> dotnet ef --version
Entity Framework Core .NET Command-line Tools
2.1.1-rtm-30846
So what do I do to update the tools? BTW, I've seen in other answers that an out of date global.json file can cause this problem. But I don't have a global.json file anywhere in the solution.
Use command line, Cmd or PowerShell for specific version:
dotnet tool update --global dotnet-ef --version 3.1.0
or for latest version use (works also for reinstallation):
dotnet tool update --global dotnet-ef
I bounced this issue over to the development team over on github. Turns out this is a known issue in the current tooling or nuget packages that get loaded when you create an EF Core-powered AspNet Core site. It's targeted to be fixed in a future release.
For now, the workaround is simply to ignore the warning.
Another workaround is also offered, involving tweaking the csproj file to define the version of the AspNet Core metapackage explicitly -- it's up to 2.1.3 as I'm writing this -- but I couldn't get that approach to work; I still kept getting the warning message.
for .NET 6, it would be
dotnet tool update --global dotnet-ef --version 6.0.0
The solution that worked for me is running the following commands in Package Manager Console:
PM> Install-Package Microsoft.EntityFrameworkCore -Version 2.1.11
PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.1.11
Make sure the version matches the one in the error message in my case I got the following error:
The EF Core tools version '2.1.1-rtm-30846' is older than that of the runtime '2.1.11-servicing-32099'. Update the tools for the latest features and bug fixes.
Check the versions available from the following site:
https://www.nuget.org/packages/Microsoft.EntityFrameworkCore/
Try this one:
Install-Package Microsoft.EntityFrameworkCore.Tools
If problem still occurs, then execute this also:
Update-Package Microsoft.EntityFrameworkCore.Tools
My solution was to install the tool dotnet-ef from microsoft https://www.nuget.org/packages/dotnet-ef. It uses the same commands but no warnings. The change is to use dotnet-ef instead of dotnet ef.
And if you already have dotnet-ef installed then use
dotnet tool update --global dotnet-ef --version n.n.n (n.n.n your version to update to)
To Solve This Issue You May Follow One Of The Following Techniques:
Technique 1: Using Package Manager Console(Especially for Microsoft Visual Studio user) PM> Install-Package Microsoft.EntityFrameworkCore.Tools -Version 2.1.2
Technique 2: Using .NET CLI > dotnet add package Microsoft.EntityFrameworkCore.Tools --version 2.1.2
Technique 3: Using Package Reference
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Technique 4: Using Packet CLI > paket add Microsoft.EntityFrameworkCore.Tools --version 2.1.2
Remember: For this version to use you need NuGet 3.6 or higher.
Reference Link: https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/2.1.2
Install a new .NET Core SDK v2.1.401 version and check >dotnet ef --version again. I had the same issue and in my case, that worked. Also, you don't need to add Microsoft.EntityFrameworkCore.Tools.DotNet.
Ignore the issue
Do not update your < PackageReference Include = " Microsoft . EntityFrameworkCore . Tools " Version ="" / >
In my case, I moved forward with 'Update-Database -Context MyElementContext' and now it is all working fine.
I found this in the book 'Programming ASP.NET Core' by Dino Esposito.
'Note This version of the CLI tooling is not the same as the version of the .NET Core runtime the application will use. The runtime version is specified in the project file, and you can comfortably edit it from within the user interface of the IDE of your choice. If you want, instead, to edit the project file manually, then it is as easy as editing the .csproj XML fi le and changing the value of the TargetFramework element. The value refers to the moniker that identifies the version (such as netcoreapp2.0).'
Like Martin
Use command line, Cmd or PowerShell for specific version:
dotnet tool update --global dotnet-ef --version 3.1.0
or for latest version use (works also for reinstallation):
dotnet tool update --global dotnet-ef
But, I've got probleme in my pc :
"When running the command whitout specifying any version i got the following error: Tool 'dotnet-ef' failed to update due to the following: The tool package could not be restored" Liko Pippo46
So, I use these steps :
dotnet tool uninstall --global dotnet-ef
But got the same problem, so I'm going to the directory of the extension :
C:\Users\Evan.dotnet\tools.store\dotnet-ef
And I found the old version (2.x)
And my second problem was the file fileproject.assets.json was not found
So I copy the fileproject.assets.json in the 2.x version to the parent repository
And all was done perfectly :
dotnet tool uninstall --global dotnet-ef
removes the 2.x version
dotnet tool install --global dotnet-ef
install the 3.1 one
I couldn't find how to update the package specifically, but in the Package Manager Console I ran 'update-package'. It ran through and updated all packages referenced in a project, including the EF Core Tools. That may not be ideal for you as that could update packages you didn't want.
Following the steps in this document helped me solve the problem - https://docs.oracle.com/cd/E17952_01/connector-net-en/connector-net-entityframework-core-scaffold-example.html
Scaffolding a Database Using Package Manager Console in Visual Studio
Open Visual Studio and create a new Console App (.NET Core) for C#.
Add the MySQL NuGet package for EF Core using the Package Manager Console. For example, use the following command to add the MySql.Data.EntityFrameworkCore v8.0.13 package:
Install-Package MySql.Data.EntityFrameworkCore -Version 8.0.13
Important
The version (for example, -Version 8.0.13) must match the actual Connector/NET version you are using. For current version information.
Install the following NuGet packages by selecting either Package
Manager Console or Manage NuGet Packages for Solution from the Tools
and then NuGet Package Manager menu:
Microsoft.EntityFrameworkCore.Design
EF Core 1.1 only: Also add the MySql.Data.EntityFrameworkCore.Design package.
Microsoft.EntityFrameworkCore.Tools version 1.1.6 (for EF Core 1.1) and Microsoft.EntityFrameworkCore.Tools version 2.0.3 (for EF Core 2.0)
Note
The .NET tools are included in the .NET Core 2.1 SDK and not required or supported for EF Core 2.1. If this is an upgrade, remove the reference to that package from the .csproj file (version 2.0.3 in this example) :
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
Open Package Manager Console and enter the following command at the prompt to create the entities and DbContext for the sakila database (adjust the connection-string values to match your settings for the user= and password= options):
Scaffold-DbContext "server=localhost;port=3306;user=root;password=mypass;database=sakila"
MySql.Data.EntityFrameworkCore -OutputDir sakila -f
Visual Studio creates a new sakila folder inside the project, which contains all the tables mapped to entities and the sakilaContext.cs file.
Even though the Oracle instructions said that Microsoft.EntityFrameworkCore.Tools was not needed for EF Core 2.1 I installed the version 2.2.0 that is compatible with EF 2.2
Update EF Core tools using dotnet CLI or Package Manager Console or visiting
this site https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/2.1.2
Or you may ignore this. It's not a big issue...
In your application, Dot.net core library version is 2.1.2 and you are working on 2.1.1 of Entity framework core(2.1.1).
So, Update your library version which should be equal to dot.net core version (2.1.2).
I got this error multiple times my packages was up to date in NuGet package manager
So I modified (.csproj) with note pad to the desired version and it solved my problem.

Nuget Package Manager for single project fails to load after adding RingCentralSDK

I'm on VS 2015, targeting .net 4.5.2, my "Nuget Package Manager for Visual Studio" in Extensions and Updates shows 3.4.4.1321.
I added all dependencies of RingCentralSDK package separately:
Microsoft.Bcl
Microsoft.Bcl.Async
Microsoft.Bcl.Build
Microsoft.Net.Http
Newtonsoft.Json
Portable.BouncyCastle-Signed
PubnubPCL
Then I right click on my project, pick "Manage Nuget Packages...", the tab opens, in the "Installed" subtab I can see the 7 packages.
Now, I install the RingCentralSDK package. My output is fine:
Attempting to gather dependency information for package 'RingCentralSDK.1.0.0' with respect to project 'MyProj', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'RingCentralSDK.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'RingCentralSDK.1.0.0'
Resolved actions to install package 'RingCentralSDK.1.0.0'
Adding package 'RingCentralSDK.1.0.0' to folder 'C:\code\packages'
Added package 'RingCentralSDK.1.0.0' to folder 'C:\code\packages'
Added package 'RingCentralSDK.1.0.0' to 'packages.config'
Successfully installed 'RingCentralSDK 1.0.0' to MyProj
========== Finished ==========
Now, I check again the Manage Nuget Packages for this specific project, and instead of seeing the list of packages, I get a yellow band:
Error occured Show erros in output Dismiss
And in the "Package Manager" output, the error is:
ZIP archive contains unsupported data structures.
In my packages folder, the folder "RingCentralSDK.1.0.0" seems ok, but then I don't anything about nuget packages format.
I cannot uninstall RingCentral via the package manager as it's not showing, not any other one, which is really annoying. I had an error when trying to do it via the command line. I reverted my changes (or remove the line in packages.config for my project), and the Nuget Package Manager tab works fine again. This is also affecting the "Managet Nuget Packages for Solution".
What can I do to fix this?
Fixed in RingCentralSDK 1.0.1-alpha1
It turns out that the NuGet package created on Mac is not compatible with Visual Studio NuGet GUI tool.
You can install the latest version by
Install-Package RingCentralSDK -Pre
Or if you prefer GUI:
Update:
For projects which already have 1.0.0 version installed, how to upgrade?
Today I did some testing and I came to the following conclusion:
New project will have no problem with 1.0.1 version or later
For old project which have 1.0.0 installed. You need to follow the following steps:
UnInstall RingCentralSDK 1.0.0
Close VS
Delete packages folder in your project
Delete packages folder in ~/.nuget/
Launch VS
Install RingCentralSDK 1.0.1
I need to do the above because nuget has cache. If I don't do it the problem just persists. I don't know the exactly reason but the above steps did work for me.

Error When Installing NuGet Packages

When I try to install EF with NuGet in Visual Studio 2013 Pro, I get this error:
Attempting to resolve dependency 'EntityFramework.Commands (≥ 7.0.0-beta4)'.
'EntityFramework.Commands' already has a dependency defined for 'EntityFramework.Relational'.
When I try to install EntityFramework.Core I get this erro:
Attempting to resolve dependency 'Ix-Async (≥ 1.2.3)'.
'EntityFramework.Core' already has a dependency defined for 'Ix-Async'.
What could possibly be the problem, I've seen others with the issue, they suggested installing an upgraded NuGet, which I did. The problem persists. No other solutions have worked.
Any one have any ideas how I can fix this? It's a VSTO addin for Outlook 2013.
Thanks
EDIT:
After restarting VS2013 after updating NuGet I tried to install EF again, got a new error:
Attempting to resolve dependency 'EntityFramework.Commands (≥ 7.0.0-beta4)'.
Installing 'EntityFramework.Commands 7.0.0-beta4'.
Successfully installed 'EntityFramework.Commands 7.0.0-beta4'.
Executing script file 'C:\Users\shenk\Documents\Visual Studio 2013\Projects\Archiver\packages\EntityFramework.Commands.7.0.0-beta4\tools\init.ps1'.
Installing 'EntityFramework 7.0.0-beta4'.
Successfully installed 'EntityFramework 7.0.0-beta4'.
Adding 'EntityFramework.Commands 7.0.0-beta4' to Archiver.
Uninstalling 'EntityFramework.Commands 7.0.0-beta4'.
Successfully uninstalled 'EntityFramework.Commands 7.0.0-beta4'.
Install failed. Rolling back...
Could not install package 'EntityFramework.Commands 7.0.0-beta4'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
However when I try to install EntityFramework.Core again, it succeeds now.
I want to use EF6, but cannot find it on NuGet, and when I try to install it with the Microsoft Download Center, it never downloads.
I'm a bit lost here so any help would be appreciated.
Upgrade NuGet to the latest version from here:
https://nuget.codeplex.com/releases/view/612846
Update:
NuGet at codeplex has been moved to https://github.com/nuget/home
Simply download latest version from:
https://www.nuget.org/downloads
The solution I found was to use IE to download things from Microsoft Download center. I was able to install EF tools for VS2012 and VS2013.
Next to install EF6 I went to Tools -> NuGet Package Manager -> Package Manager Console. In the console I entered Install-Package EntityFramework You can also do Install-Package EntityFramework -pre to get the latest release (7.0.0-beta4)
This worked for me. Unless someone else has a better solution I will accept this one in a day or so.

Nuget not reinstalling packages

I have modified the target .net framework to use 4.5 from 4.0. I got a message from nuget that packages need to re-installed so ran Update-Package -Reinstall -ProjectName https://localhost/SomeWebProject/. As nuget was executing, it spitted out yellow warning signs that looked like this:
Skipped reinstalling package 'NLog 3.1.0.0' in project 'SomeWebProject' because the package does not exist in the package source.
Why aren't my packages being reinstalled? I went into my packages folder and verified NLog 3.1.0.0 exist!
Turns out the solution is hiding in plain sight.
All we have to do is set the Package Source in the Package Manager Console window. (Credits to Matt Ward for pointing it out.)
Or you may run the following NuGet Package Management command:
'Update-Package -reinstall'
This command will reinstall all your solutions NuGet packages without updating the version(s) of existing packages.

DotNetOpenAuth NuGet Install - but Samples are problematic

I installed DotNetOpenAuth using NuGet and downloaded the 4.1 zipfile with samples, but am having difficulty trying to incorporate the Facebook.aspx sample into the new project. The sample code-behind refers to DotNetOpenAuth.OAuth2, but I cannot seem to resolve this reference with the NuGet install. What am I missing?
Note that I built the DotNetOpenAuth.ApplicationBlock sample and added the refernce into the new project.
Please run this NuGet command to install the DotNetOpenAuth.OAuth2.Client package:
PM> Install-Package DotNetOpenAuth.OAuth2.Client -Pre