Virto Commerce compile errors after updating nuget packages in Visual Studio 2017? - virtocommerce

After downloading Virto Commerce source and compiling in Visual Studio all went smoothly. After updating NUGET Packages, I get compile errors. Please see graphic.
Compile errors

In your case, you have updated Netonsoft.Json and it cause obsolete method compilation error.
You should avoid updating nuget packages yourself, this should be done by the platform team.

I've applied only Minor Updates and all works as expected.
So, I recommend to install major updates of NUGET packages carefuller.

Related

Error running the selected code generator in Visual Studio

I keep getting this error when trying to add a scaffolded item to my presentation layer.
Packages I am using
It looks like scaffolding the items installing the older version of Microsoft.EntityFrameworkCore.SqlServer or Microsoft.EntityFrameworkCore then your project currently depends on.
There are several ways that might help you fix the said issue. You could try them one by one.
Try to clear Nuget Cache.
Go to Tools in the Visual Studio
Options
NuGet Package Manager
General
Clear All NuGet Cache(s)
If the issue persists, try to manually update the packages Microsoft.EntityFrameworkCore.SqlServer or Microsoft.EntityFrameworkCore
Try to update the rest of the NuGet packages.
Reference: Package restore failed. Rolling back package changes

Unable to build solution using PostSharp in Visual Studio 2022 after moving code to new computer

I've just recently started using a newly installed PC but am having trouble building a solution in Visual Studio 2022 that uses PostSharp (version 6.10.5). It works without problem to build the same solution on my old computer and strangely enough a colleague of mine who also recently installed a new computer has no problem building the solution.
Visual Studio throws a bunch of NU1101- and NU1102-errors such as these:
It also hints to the following information regarding PostSharp which I'm not sure how to fix?
The process "C:\Program Files\dotnet\dotnet.exe" failed with exit code 1.
Restore of compiler dependencies failed. To disable compiler dependencies restore use PostSharpDependencyRestoreDisabled=True MSBuild property.
Unable to start PostSharp due to previous error encountered while creating fallback package directory.
We're including PostSharp via a private Nuget package where we're referencing PostSharp like this after input in this thread: How to have PostSharp included in build process for ASP.NET WebApi project when installed using our own Nuget package?.
<PackageReference Include="PostSharp" Version="6.10.5" PrivateAssets="none" />
If I exclude everything related to PostSharp, the solution builds just fine but not with PostSharp included. Any help here would be very much appreciated.
/Martin
If NuGet errors are in the build output and immediately before the error stating that PostSharp's dependency restore had failed (not apparent from screenshots), PostSharp is attempting to gather its references for the first build on the machine.
PostSharp does this by running NuGet restore under current settings for packages it depends on (e.g. System.Runtime.CompilerServices.Unsafe).
Since NuGet sources that are enabled for the build seem to include only "Offline packages", it is not able to find required packages as these are not present on your machine.
The solution is to run the build once with NuGet.Org package source enabled. PostSharp should then be able to download its dependencies and all subsequent builds should run without problems (unless you upgrade to a new minor version of PostSharp). The presence of NuGet.org package source is probably the difference between machines that causes this problem.
As mentioned in my comment to the answer above the solution to my problem was to:
Remove our own nuget.config file (even if it contained a reference to the nuget.org package source)
Add a reference to the nuget.org package source (https://api.nuget.org/v3/index.json) in Visual Studio under Tools --> Nuget Package Manager --> Package Manager Settings --> Package Sources
Build the solution again
Add our own nuget.config file to the solution again

Newer versions of NuGet.exe can't resolve framework match when restoring older packages (net40, netframework40)

having spent the better part of two days on this, time to get some help.
I am reworking our CI build, and have a VS2017 solution which was on .net 4.6.1, using packages.config style nuget refs, and TeamCity was using the NuGet runner v3.4.4 to restore the packages. It was originally build probably using VS2008 or 10, then converted to 2017 in 2018. Someone checked in the packages directory and it's been that way for years.
Time to bring it up to more modern standards. I converted the projects to use packageReference, and now am using msbuild and the restore;build target to restore my packages and build the solution. Works well EXCEPT for this one package.
Even in VisualStudio 2017 15.8.7, the build (which does the restore of course) is failing to restore the smtp-impostor package using a packageReference with the following error:
NU1202: Package smtp-impostor 2.0.8 is not compatible with net461 (.NETFramework,Version=v4.0). Package smtp-impostor 2.0.8 supports: netframework40 (.NetFramework 4.0,Version=v0.0)
I can't get Google to find a single useful post when searching for "netframework40".
If I use nuget3.4.4 CLI, it works fine (it seems to call msbuild 4.0). If I use nuget 5.6 CLI, I get the error message; it's using the msbuild that comes with Visual Studio 2017.
I see a lot of posts on how to get nuget to use a different version of msbuild, but I don't see how to tell msbuild to use an earlier version of nuget!
I have tried:
retargeting the solution to v4.0 - same error occurs - first part of error just changes to net40
setting the ToolsVersion in the csproj file tag to 14.0
Setting the PlatformToolsVersion property in the csproj file to 14.0.
No dice.
I really don't want to stay with packages.config for this project (and an extra CI build step) nor checkin the single DLL for the package into my repo. It's looking more like I'll jsut have to scrap the packageReference upgrade and stick with the old style nuget runner package restore.
Anyone ever seen this? Any ideas where "netframework40" comes from and why newer nuget can't match it with net40?
Thank you in Advance!
Newer versions of NuGet.exe can't resolve framework match when
restoring older packages (net40, netframework40)
The issue is that this nuget package smtp-impostor 2.0.8 is not compatible with the new PackageReference format and has nothing to do with Nuget V3.4.4 or Nuget V5.6.x.
Actually, the package was published on 2011 and the new package management format PackageReference was used since VS2017.
Besides, the author did not make any changes to the package to accommodate the new Packagereference. And I faced the same issue in my side.
Suggestion
As a workaround, you have to use packages.config to install this nuget package rather than PackageReference.
Since VS2017, VS adds the new PackageReference nuget management format and for your old VS2008, it uses Packages.config.
Or you could contains the author of the nuget package to change it.

VS2015 Nuget error but not using Nuget at all

Yesterday i upgraded from visual studio 2010 to vs2015. I have an existing project, a simple Windows Forms application that used to build without problem. Now when building the project in VS2015 i get Error while restoring Nuget packages, HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY).
I'm not using Nuget, don't know what Nuget is, have no nuget package folder in my project, so don't have the slightest idea what goes wrong.
Searched a lot for solutions but they all seem to refer to problems using packages, not to problems with not using packages.
Can anyone help me out?

Nuget Package Manager Fails To Install Some Packages For UWP Apps

I haven't had problems with nuget until now, i created a blank a UWP project and decided to add some few nuget packages to it and it keeps saying 'Package restore failed. Rolling back package changes for App1'. But when i do this a WPF project it successfully install. Does anyone here knows why this is happening or is also ?
I ran into the same problem with other packages. The problem is that many NuGet packages don't seem to be compatible with UWP. This incompatibility info is shown in the output console rather than the error console of Visual Studio.
See also .NETcore, UWP - can't install NuGet package.