Detected package downgrade: Microsoft.EntityFrameworkCore.SqlServer from 2.2.6 to 2.2.4 - visual-studio-2017

I have an ASP.NET Core Web API Application, I was instructed to update the NuGet Packages, once I started upgrading, NuGet started throwing errors about missing dependencies, after going one by one (one depends on other that was not installed and that one depends from another 2 that were not installed and so it goes); I encountered the following error where I got stuck:
Detected package downgrade: Microsoft.EntityFrameworkCore.SqlServer from 2.2.6 to 2.2.4. Reference the package directly from the project to select a different version.
Below that error I see that "Install a Reference to Microsoft.EntityFrameworkCore.Abstractions 2.2.6 to solve the issue"
But when I try to do that, it throws:
"Version conflict detected, Install a Reference to Microsoft.EntityFrameworkCore 2.2.6 to solve this issue"
Of course this is a circular error is not giving me options, I tried to install version 2.2.4 and threw the same conflict error (but related to version 2.2.3 and so on).
This is Visual Studio Enterprise 2017, ASP.NET Core 2.1
I already tried adding true
To the .cproj file and did not work at all

I think you've gone down a rabbit hole here. The exception, in general, just means that your project is getting two references for the same package and one of those references is to a lesser version. That could happen for any number of reasons, but it generally boils down to two possibilities (or a combination of the two):
You've got different metapackages that reference the same package, and the metapackage versions are mismatched.
You've got one or more project dependencies, and those dependent project(s) use different versions of the same package/metapackage.
The stuff about "install a reference to Microsoft.EntityFrameworkCore.Abstractions" are usually red herrings. It's calling out the specific package reference version mismatch, but that doesn't mean that literally installing that package is the best approach.
The big thing is going to be metapackages, as these are basically just multiple packages rolled into one reference. The actual underlying packages and their versions are not directly referenced, but they're there, just as if you'd directly added the reference. As such, it's not always clear that two separate metapackages are actually using one or more of the same packages under the hood.
The best course at this point is to rollback your package reference changes. You've probably introduced more problems than you've solved. Remove any extraneous or superfluous references. For example, if you've got a reference to both Microsoft.EntityFrameworkCore and Microsoft.EntityFrameworkCore.Abstractions, remove Abtractions. It's easiest to do this by directly editing the .csproj file. Go project by project in your solution and pare back packages to only the ones absolutely necessary for your project(s). Hint: if you start seeing red squigglies in your code, you actually needed that one.
Once you've done this, upgrade all the NuGet packages for the entire solution all at once. Literally, right-click the solution and choose "Manage NuGet packages for the Solution". You should also check the "Consolidate" tab and ensure that there's nothing there, i.e. you're running the same versions of everything across all projects. Then, you should be good to go.

Related

microsoft visual studio installer projects issue

I made a laucher application in c++ that use direct 2d and 3d. Now i making a installer for this. I followed microsoft docs and i made it but there is a issue.
I use 'Microsoft Visual Studio Installer Projects' extension to make that.
The issue is if i already installed my launcher with a previous installer msi file, if i rebuilt a new installer msi and try to run it it show me this error
This is the microft docs i followed to make this: https://learn.microsoft.com/en-us/cpp/ide/walkthrough-deploying-your-program-cpp?view=msvc-160
In the future maybe i need make a update for my laucher. It isn't good idea everytime need go to control panel, search and delete the previous application and install the new one manually.
Anyone know how can i make it automatic remove old version and install new one? Maybe there is a better way to create a installer?
Major Upgrade: In order to upgrade properly, you need to use a major upgrade so that your new version uninstalls the old one and then installs itself (this can happen in reverse order too: new version installed and old remnants deleted afterwards, but this is another story). There are further upgrade types, but stick to major upgrades for simplicity.
The message you are receiving is basically because you have a different package code for the new MSI, but not a new product code or version number (or just one of those problems). You need to get the settings straight.
Recommended step-by-step:
Set "RemovePreviousVersions" to True in the project properties.
In the same place: bump up your version number (one of the first 3 digits)
Answer yes when asked to change product code, or do so yourself manually.
Keep the UpgradeCode the same - it needs to be stable across releases.
Rebuild your setups. Clean out your box of old remnants before testing or test on a virtual.
Testing: Remember to simulate your full upgrade process from first version installed to the new one with different version numbers for a few core files and also try to add a few files and such things. Very important to verify.
Heads-Up: Before ending, it is standard procedure to warn about the potential limitations of VSInstaller Projects (shorter list form).
MSI Tools: Here is a short "review" of other MSI tools.
MSI Upgrade Types: Shamelessly stolen from the InstallShield help file (towards bottom):

NuGet package version is ignored when building

I am using VS 2017. I have this line in my packages.config file.
<package id="System.IdentityModel.Tokens.Jwt" version="4.0.4.403061554" targetFramework="net461" />
I got this error my trying to start my .net application.
System.TypeLoadException: Could not load type 'System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause' from assembly 'System.IdentityModel.Tokens.Jwt, Version=5.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Because System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause really does not exist in version 5.2.1.0. But it seem NuGet simply ignores the version specification, and always loads the latest version.
I have tried to clean NuGet caches, clean and rebuild entire solution, and restart computer...
Is there anything else I can do?
Update
One strange thing I observed in VS 2017. Notice the differences of the icons for System.Data and System.IdentityModel.Tokens.Jwt. When I try to check the properties of the latter, VS says the package is not installed, which it clearly did. The build went successful, but the application just wont load the right version.
There are a couple of steps you can perform to check that the right version is loaded:
Rebuild your solution to make sure all NuGet packages are restored and that the started application is up to date (You already did that).
Check the tag HintPath for the reference in the project file that references the package. Just open the file in a text editor and look for an XML tag starting with <Reference Include="System.IdentityModel.Tokens.Jwt. Make sure that no version-specific reference is set or that the version matches the version in the packages.config file.
Check in the properties of the according reference in Visual Studio that it is resolved correctly. That means, there must be no yellow exclamation-mark icon on the reference in the solution explorer and in the properties of the reference, the Path entry must point to the installed package. Hence, the path should point to the packages directory inside your solution directory and therein into a directory System.IdentityModel.Tokens.Jwt.4.0.4.403061554.
In most cases (from my experience), there is some mismatch between the reference in the packages.config file and in the project file. If that does not help, make sure that no other module is loaded by your application that has a reference to System.IdentityModel.Tokens.Jwt in version 5.2.1.0.
So far, it is still unclear why VS cannot handle the changes of the NuGet packages, and why it thinks my project is using both .Net Framework and .Net Standard at the same time. I bet it is a but in VS, and hope MS can fix it soon.
Before that, installing Rider and use it to fix the packages, then went back to VS, and everything went back to normal.

VS2017 RC1 Installation installation error - Microsoft.PortableLibrary.TargetingPack.Msi failed - No XAML

I had errors installing VS2017 with
Package 'Microsoft.PortableLibrary.TargetingPack.Msi,version=15.0.26004.1' failed to install
The actual IDE will open but I don't have any XAML functionality - it appeared to fail the installation before this component was installed. XAML files won't load and there is no XAML listed under 'Text Editor'.
How to fix this error?
After several hours finally managed to get it to work:
Still not sure exactly what a targeting pack is - and why VS couldn't install it but I manually installed this package and managed to get it to work:
Manually installed:
Microsoft .NET Framework 4.6.2 Developer Pack and Language Packs
https://www.microsoft.com/en-us/download/details.aspx?id=53321
Other things I did that may have contributed to the solution:
I rebooted
I removed all files in C:\ProgramData\Microsoft\VisualStudio\Packages - actually I moved them to an OLD folder and later deleted them. You will see packages downloaded here after you restart the install.
I had previously created a symbolic link from %ProgramData%\Package Cache to another drive to save space (https://superuser.com/questions/455853/can-i-delete-the-folder-c-programdata-package-cache). This symbolic link didn't seem to work anymore leaving me with some files in %ProgramData%\Package Cache and the rest in the other drive. I moved them over and recreated the link. If this is something you did to save disk space and forgot then that could contribute towards a failed solution.
Something above fixed the issue and I now have XAML back again.
Note: The VS2017 RC1 does not support offline installation so that was another avenue I explored and gave up on. The command line switches currently do NOTHING.
I believe the package I needed is the following one but not absolutely sure.
C:\ProgramData\Microsoft\VisualStudio\Packages\Microsoft.PortableLibrary.TargetingPack.Msi,version=15.0.25719.0

Trying to switch from Xunit.KRunner to xunit.runner.kre?

Today after updating our projects it seems Xunit.KRunner is no longer available on NuGet. We checked the Microsoft projects and it looks like they are using the xunit.runner.kre package. When trying to install this the xunit.assert assemly is failing to download from Nuget. Any suggestions to get this working? I am guessing that the versions are messed up.
Here are my nuget package locations:
I'm also using the beta2 version of the kre.
There is/was an issue with the new xunit.runner.kre and VS CTP 5. See below discussion:
https://github.com/aspnet/Testing/issues/65
xunit.runner.xre is available only on myget/vnext feed. Include that in the Nuget.config that you should be able to restore the package
By running on the beta2 kre you're then having mismatched dependencies. If you look at the versions of your xunit bits they're all beta3. I'd recommend upping your kre to beta3 to fix your issue (will affect which packages your app pulls in).
Also as a side note I'd recommend ensuring your nuget.org/api/v2/ feed is enabled (in the SS you posted it wasn't). There's currently an issue where it'll occasionally disable itself; has definitely made my life frustrating several times when things don't build :).

Template requires newer script versions than project contains

I try to use the breeze/angular template for MVC 4. However, during start up I get this:
Package installation error
Could not add all required packages to the project. the following packages failed to install from .../asp.net mvc 4\packages
jquery.ui.combined.1.9.2 unable to find version 1.9.2 of package.
Now I see that the folder contains jQuery.UI.Combined.1.8.24, so I was wondering:
Is there a way to edit the project so that it (maybe always) uses the latest versions of the packages by default?
Should I just press OK and afterwards install jquery.ui through nuget afterwards?
Is there a clever way to fix this?
I know there has to be a solution due to the uglyness of getting an error by default when using a custom template. I've been googling my ass off without any results :(
Hope to update the templates soon and get MS to republish. You can't update the template easily yourself.
Fortunately, this particular issue is easy to workaround by adjusting your code to use latest jQuery or rollback to 1.8.x.
I can't use the latest verison of jQuery so I manually updated the jQuery files to 1.9. Also, check your nuget manager for updates. Breeze released 1.3.6 which will update the appropriate dependent project libraries (my jQuery files were untouched).
As of Visual Studio 2012 Update 3, the Breeze/Angular SPA template is totally broken. The jQuery update fix worked with VS2012 Update 2, but some change or another in Update 3 has made VS not play nice with the sample.
It isn't ideal, but given that Update 4 is just around the corner, we might need to hold our breaths in anticipation of a post-Update 4 fix. :(