xunit nuget package restore failed - nuget

I've come to a problem while trying asp.net vNext beta8. I'm running a working project but I wanted to add a unit test project next to it. I've found that you should add the xunit and xunit.runner.dnx nuget packages in the project.json. while typing, the intellisense continuous me so I see that the package must be downloaded from nuget. after saving the project.json i get the error in my output, which says: An error occurred while sending the request.
Does anyone else get this problem or does anyone know the solution?
Thanks in advance :)

My problem appeared to be a corporate proxy which didn't like visual studio and the nuget package manager. when working on the guest network I was able to restore all the packages.

Related

Visual Studio can't resolve Nuget dependencies after reinstalling operating system

I recently reinstalled my Windows 10 OS, and now Nuget packages are "not compatible". After an explanation, I will be asking, how do I resolve this problem.
Lead up
Due to an unrelated problem, I had to reinstall my operating system. In the course of that, I reinstalled Visual Studio 2019. I cloned my repository (https://github.com/PaulSchrum/CogoDN), then opened it locally with VS.
Now when I build, I get several Nuget errors and warnings. These Nuget dependencies have been present in my code since December 2019, and never caused me a problem until this month (July 2020) associated with the reinstallation of VS.
Question: How do I resolve this problem?
Other Details
I am targeting .Net Core 3.1, but it happens no matter which version of .Net Core I target.
The main error seems to be of the pattern:
NU1202 Package System.Drawing.Common 4.5.0 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1).
This is happening for System.Drawing.Common, netDxf.netstandard, and packages necessary for Microsoft Tests. Specifically, it can't recognize using Microsoft.VisualStudio.TestTools.UnitTesting; (namespace 'VisualStudio' does not exist), and every attribute ([TestClass], [TestMethod]) now is a syntax error.
What have I already tried
Various combinations of reestablishing the Nuget packages. This includes at least twice clearing the Nuget cache and installing the dependencies again. I also followed the advice here: https://stackoverflow.com/a/63108317/1339950 (Item 3) Close VS, Delete global NuGet.config, start VS and let it rebuild Nuget.config.
None of these work.
One last note: I have tried so many things and got into various different states of not working that my description may have inadvertently conflated a few details.
Visual Studio can't resolve Nuget dependencies after reinstalling
operating system
It is quite strange and in my side, I can also build the project without any errors.(I download the project from your github link and then open it with VS0219----build well).
So I think your Net Core SDK or VS IDE have broken.
1), please try to install the latest Net Core 3.1 Developer SDK.
Or you could open Programs and Features from Control Panel, then right-click on every net core sdk-->Change-->Repair
2) run sfc /scannow to scan your os and you can refer to this link for more steps.
3), try to do a repair in VS Installer. Or if your VS2019 is not the latest, please update it to the latest version.
4) try to create a new net core project and then install these nuget packages to check if the issue still persists.

NuGet Installation of EntityFramework

I have been doing some testing between VS2015 and VS2017. I created a .NetFrameworkApp and a .NetCoreApp website in both systems. I then installed a couple of packages in all four websites; in particular EntitytFramework. It installed in both VS2015 websites and the VS2017 .NetFrameworkApp website without problem but it wouldn't install in the VS2017 .NETCoreApp website. I got the following error messages.
net45 (.NETFramework,Version=v4.5)
One or more packages are incompatible with .NETCoreApp,Version=v1.1.
Package restore failed. Rolling back package changes for 'RLSBCWebSite_NC'.
Time Elapsed: 00:00:01.4470850
Error Package restore failed. Rolling back package changes for 'RLSBCWebSite_NC'. 0
Anyone any idea why that should be. I am assuming it should install otherwise how would you use CodeFirst etc.
The "EntityFramework" package is not supported with .NET Core App, use the:
Microsoft.EntityFrameworkCore.SqlServer
package instead

NuGet cannot restore AutoMapper 5.1.1 on TeamCity 10

With NuGet 3.3.0 we get the following error when restoring AutoMapper 5.1.1. Other packages restore successfully:
[11:49:53] [restore] Unable to find version '5.1.1' of package 'AutoMapper'.
[11:49:53] [restore] Process exited with code 1
There was an issue we had where we were unable to restore this package in Visual Studio 2013 on our dev machines unless we updated the NuGet package manager.
If we build the project in Visual Studio 2013 on the TeamCity server, the package restores successfully, leading us to believe that it's the NuGet version on the build agents that needs updating.
We tried to upload the NuGet.CommandLine.3.4.3.nupkg via the TeamCity | Tools menu, however TeamCity complains that it's not a valid NuGet package because it doesn't contain tools\NuGet.exe, even though it does!
We did manage to successfully upload Nuget.CommandLine.3.6.0-beta1.1839.nupkg, however that gives us a different error when the build step attempts to run.
So we're stuck. Has anyone out there had this issue and managed to resolve it?
Uploading NuGet.CommandLine.3.5.0-beta-final.nupkg to TeamCity (Administration => Tools => NuGet.exe => Add Version) and setting the NuGet build step to version 3.5.0-beta-final successfully resolved our issue.
I got the package from: https://dotnet.myget.org/feed/nuget-build/package/nuget/NuGet.CommandLine/3.5.0-beta-final

azure mobile service .net backend not working after nuget packages update

After updating the nu-get packages for a previously working Azure Mobile Service (.Net back-end), I now get the following error when accessing Table Controllers:
An error has occurred.","exceptionMessage":"Object reference not set to an instance of an
object.",
"exceptionType":"System.NullReferenceException",
"stackTrace":"at Microsoft.WindowsAzure.Mobile.Service.Serialization.
SelectExpandWrapperConverter.ODataReflectedTypes..ctor()
at Microsoft.WindowsAzure.Mobile.Service.Serialization ...
Custom Controllers appear to be unaffected.
I've probably missed something obvious, but I can't see it
Any help would be appreciated
Many Thanks
K.
From Henrik F. Nielsen's answer in the MSDN forums:
There are known incompatibilities with the latest version of ASP.NET Web API which was released the same day as our last update. We are working on an update but in the mean time please don't update all your NuGets but only the WindowsAzure.MobileServices.* packages -- they will then include the right dependencies the need.
This is an integration issue with the .NET backend binaries, and it should be resolved soon.
Expanding on #carlosfigueira's answer, it seems that the WepApi 5.2.0 version is not compatible with Azure Mobile Services yet.
I am one of the unfortunate ones who decided to let nuget go to town and update all the packages in the project so here is what I did to deal with this.
Uninstall every nuget package from your mobile service project. Then add them back. Start by using only the Microsoft Azure Mobile Services.NET Backend.* packages - This will pull the currently compatible WebApi 5.1.2 instead of 5.2.0. and other dependent assemblies.
In addition, I was getting a lot of weird redirect binding errors which I believe the tooling added incorrectly - so I commented out all the dependentAssembly tags in the assemblyBindings and then added them back as the mobile service complained. All I had to add back for redirects were Newtonsoft.Json and Microsoft.Owin. YMMV.
I think this may also have something to do with the fact that there are strange interactions between VS and source control plugins since nuget packages sometimes fail because they can't obtain write permissions for packages.config and web.config files.
I am also using a PCL in my service which requires adding the Microsoft.Bcl libraries - perhaps irrelevant but it is what lead me to discovering the underlying error.
Under Tools -> Options -> Projects and Solutions -> Build and Run, set the MSBuild project build output verbosity to Detailed or above to get some insight into what is happening in the process.
[Update 12/24/2014]
I updated something I shouldn't have and everything broke again.
Uninstall all nuget packages. Delete all dependentAssembly elements from the Web.Config file. Save and restart Visual Studio.
Start adding packages back using the following from the Package Manager Console. In my case:
Install-Package WindowsAzure.MobileServices.Backend -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.Tables -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.Entity -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.SignalR -Version 1.0.405
Install-Package WindowsAzure.MobileServices.Backend.Storage -Version 1.0.405
Never touch it again...?

Error "SolutionDir property not found in project" when installing SlowCheetah

I wanted to try out SlowCheetah so I:
Created a test web project (ASP.NET MVC 4 Web Application in Visual C#)
Enabled Package Restore by checking "Allow NuGet to download missing packages during build"
Installed SlowCheetah via Package Manager Console with Install-Package SlowCheetah.
Since I'd like this to work with a build server later on, I got a bit worried when this error message shows up:
SolutionDir property not found in project [TestWeb].
Have you enabled NuGet Package Restore? This is required for build server support.
You may need to enable it and to enable it and re-install this package
What does it mean and why can't it find SolutionDir?