Can't install/update nuget packages - windows

I run into an issue when trying to compile an open-source github project ;
I launch Visual Studio Community, then try to update the nuget packages but to no avail ; I get the error
"An error occured while trying to restore packages: Unable to find
version '1.0.0' of package 'vcpkg.C.dev.vcpkg'."
I tried looking on the internet, installed vcpkg and did everything right, but still, it stays here. I tried to check if I can do anything by restoring nuget packages, but still, nothing is working

Related

NuGet package restore failed when building Windows Calculator

I am trying to build Windows Calculator (Microsoft/Calculator on GitHub) with Visual Studio 2017 Community version. I followed the instructions but got an error message starting with:
NuGet Package restore failed for project Calculator: Unable to find version '1.0.2' of package 'Microsoft.WindowsCalculator.PGO'.
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\: Package 'Microsoft.WindowsCalculator.PGO.1.0.2' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'.
https://api.nuget.org/v3/index.json: Package 'Microsoft.WindowsCalculator.PGO.1.0.2' is not found on source 'https://api.nuget.org/v3/index.json'.
Please see Error List window for detailed warnings and errors.
(......build started and failed)
I checked nuget.config found in the repo and it mentions https://eeapps.blob.core.windows.net/eeapps/index.json, which did not appear in the error message. It seems to me that nuget failed to check this location for packages. How do I restore the missing packages?
NuGet package restore failed when building Windows Calculator
To resolve this issue, you should add the specify nuget source (https://eeapps.blob.core.windows.net/eeapps/index.json) to the Package Source in the Visual Studio:
Tools->Options->NuGet Package Management->Package Source:
Then you can see those packages:
Now, you can restore the nuget packages with the options Restore NuGet Packages when you right click on your solution file.
Hope this helps.
After some research I realized the problem actually has nothing to do with NuGet.
I cloned the repo with git on WSL (Ubuntu app), and after reading this answer I retried cloning with Git on Windows and the problem simply disappears.
It seems that git clone on WSL and Visual Studio just don't get along. Related GitHub issue here.

The specified task executable location ......csc.exe is invalid error

I have a project on TFS that is working on everyone else's machine, except mine. When building I get the error that can be seen in the image. "The specified task executable location csc.exe is invalid." currently trying to repair VS 2017 now.
Based on the message, seems the csc.exe is damaged.
Just try below things to narrow down the issue:
Navigate to the Microsoft.Net.Compilers package location, delete
the package folder, then rebuild. Generally the package will be
restored automatically during the build.
YOUR_PROJECT_DIR\packages\Microsoft.Net.Compilers.2.6.1
Uninstall and Re-install the Microsoft.Net.Compilers package:
Open Visual Studio
Go to Tools -> NuGet Package Manager -> Manage NuGet Packages for Solution
Go to Installed tab and find Microsoft.Net.Compilers package
Uninstall the package from your project
Try to build your project now. (Thus it will use the default compiler which lives in the .NET framework folder:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe)
If you really need the Microsoft.Net.Compilers package then go ahead and find it in the Browse tab and install the latest stable
version.
Build the project and if everything works, make sure you commit changes to your code repository.
You can also try to run below command to uninstall and reinstall the
Nuget packages from the Package Manager Console: See Microsoft.Net.Compilers
Uninstall-Package Microsoft.Net.Compilers -Version 2.6.1
Install-Package Microsoft.Net.Compilers -Version 2.6.1
Remove Microsoft.CodeDom.Providers.DotNetCompilerPlatform and Microsoft.Net.Compilers Nuget Packages.
Installing MSBuild 2015 will resolve the issue.
https://www.microsoft.com/en-us/download/confirmation.aspx?id=48159
I hit this question even though my error was "The specified task executable csc.exe could not be run" when pulling down existing web project with unit tests and trying to run it locally for the first time.
I was able to resolve this by building each project individually in my solution.

Can't Install NuGet packages that require Newtonsoft.Json.10.0.1 in Visual Studio 2015

I've been having problem installing NuGet packages that require Newtonsoft.Json.10.0.1
I just recently installed it and when ever I try installing packages that need it, I get this error:
Severity Code Description Project File Line
Error An error occurred while retrieving package metadata for 'Newtonsoft.Json.10.0.1' from source 'C:\Users\Sharon Umute\documents\visual studio 2015\Projects\sermon\packages'. 0
I tried upgrading to Newtonsoft.Json.10.0.2 and adding the path to Environment Variables but I keep getting the same error.
I've checked the path, the Newtonsoft.Json.10.0.2 folder contains lib, tools, and Newtonsoft.Json.10.0.1.nupkg.
I'd really appreciate some help with this.
I had a similar problem when installing System.Net.Http. Simply remove the line that references Newtonsoft.Json in packages.config. It solved my problem
I had this issue when trying to upgrade my packages and resolved it by upgrading to Newtonsoft.Json version 10.0.1.
In package manager run:
Install-Package Newtonsoft.Json -Version 10.0.1
After that, all my other packages were able to update.
open packages.config, delete <package id="Newtonsoft.Json"..>, then refresh it

Microsoft.NETCore.APP >= 1.01 could not be resolved on Windows 7

I have installed Microsoft Visual Studio 2015 Enterprise edition update 3 on my Windows 7 machine.I also installed .Net Core packages from this link:
https://www.microsoft.com/net/core#windows
I rebooted the machine after the installation. Now when I try and create a simple web application it throws errors related to project.json. The following are the errors thrown in Visual Studio 2015:
Severity Code Description Project File Line Suppression State
Error NU1001 The dependency Microsoft.NETCore.App >= 1.0.1 could not be resolved. WebApplication14 C:\WebApplication14\src\WebApplication14\project.json 3
I haves similar errors to all the dependencies in the project.json file. I tried many options mentioned online but it did not resolve the issue. I also tried uninstalling and installing .Net core and no luck. Could you let me know how I could fix this issue.
I was able to resolve the issue. I tried uninstalling and installing .Net core and it did not work. The problem was with the NuGet Cache. The cache is stored in different location and we need to clear it which will help the packages to be restored. Follow these steps:
Go to the directory where nuget.exe has been installed and run these commands:
1) nuget locals all -list
2) nuget locals all -clear
When you run the second command you will get a warning we can just ignore that.After executing these two commands restart Visual Studio and open the project solution and it should work.

Is it possible to restore Nuget packages with a Xamarin.iOS build using TFS online?

I am trying to automate my build process for my Xamarin.iOS application. I have managed to get a Xamarin.Android and UWP build working find on my on site Windows build agent.
I am now trying to build a Xamarin.iOS application using my On Site Mac build agent.
I have added the Restore Nuget packages as the first step in this build definition but keep getting the error:
MSBuild auto-detection: using msbuild version '4.0' from
'/Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5'.
MsBuild.exe does not exist at
'/Library/Frameworks/Mono.framework/Versions/4.2.3/lib/mono/4.5/msbuild.exe'.
Error: /usr/local/bin/nuget failed with return code: 1 Return code: 1
But I'm not sure what it's trying to do here at the nuget installer stage.
So is this possible to do?
There is a known issue with nuget restore command on non-Windows operating systems:
Restore - Restore works with packages.config and project.json files
but will not yet work with *.sln solution files
So you can try to update the "Restore Nuget Packages" step to restore the packages.config file instead of solution file. If it still does not work, then try to change the "Installation type" from "Restore" to "Install".
NuGet 3.2
With NuGet 3.2, the following commands have been tested to work:
Config
Delete
Help
Install
List
Push
SetApiKey
Sources
Spec
Refer to this link for details: NuGet Compatibility.
I was having a similar issue. My log said:
Unable to find version '2.1.0' of package 'Acr.Support'.
[error]Error: /usr/local/bin/nuget failed with return code: 1
After some digging in the logs I tried to restore the nuget packages on my local mac. I opened the terminal and typed :
sudo cd /usr/local/bin
[enter password]
Your nuget executable should be located there.
I executed:
nuget
To see my nuget version, which was 2.12.0.0
I noticed that this is an old version so I updated it by:
sudo su
[enter password]
nuget update -self
I noticed that it updated to 3.4.4 rtm final, I started my Visual Studio Online flow again and it worked! Hopefully this helps anyone.

Resources