NuGet package restore failed when building Windows Calculator - windows

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.

Related

Can't install/update nuget packages

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

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.

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.

error Build: File 'COMPUTE_PATHS_ONLY.ts' not found in visual studio

I received the following error after the repair of visual studio 2015.
Error Build: File 'COMPUTE_PATHS_ONLY.ts' not found.
COMPUTE_PATHS_ONLY.ts is not from my Git repo. Other files in the Git repo have not changed. What could it be?
I found answer here, it works for me: https://github.com/Microsoft/TypeScript/issues/7445
the error indicates that there is a mismatch between your targets (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets) and the tasks dll (C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\TypeScript.Tasks.dll); this would be an issue with the installer not handling a specific order of installing different versions.
Can please try:
uninstall TS 1.8.* from Add/Remove Programs
uninstall TS 1.7.* from Add/Remove Programs
make sure the folder C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript is empty, if not remove it manually
install TS 1.7.6 again, you should see the folder created in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript
For me the solution was to move the folder at
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript
to
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript
and overwrite everything there.
This answer helped me a lot, I could solve my problem this way
When I removed "COMPUTE_PATHS_ONLY" from the
line Configurations="$(TypeScriptBuildConfigurations)
COMPUTE_PATHS_ONLY" in the file Microsoft.TypeScript.targets, my
problem was solved.
The steps mentioned above will not guarantee to fix your issue. After following the steps mentioned above I was keep getting the same compiler error.
I restarted my machine after "uninstall and install" operation but no luck.
Finally, I found that instead of doing all these from control panel we have to do it from package manager (Right Click on solution and select "Manage Nuget packages for solution.."
First uninstall the TS package for your project from package manager and then install the package and build.
Img of project setting
I was using the VS 2015 update_1 and type script version 1.8
For me it was solved by updating VS 2015 in update_3
https://msdn.microsoft.com/en-us/library/mt752379.aspx

Heroku build failing when restoring NuGet packages

I'm nearly there getting my F# project to compile under Heroku.
Unfortunately I've hit a problem.
It attempts to restore the nuget packages I get the error:
Target Build:
Project "/tmp/build_7ab344f5-4cd2-4af5-92cd-814069a4af70/NancyFirstProject/NancyFirstProject.fsproj" (default target(s)):
Target RestorePackages:
Executing: mono --runtime=v4.0.30319 /tmp/build_7ab344f5-4cd2-4af5-92cd-814069a4af70/.nuget/NuGet.exe install "" -source "" -RequireConsent -solutionDir "/tmp/build_7ab344f5-4cd2-4af5-92cd-814069a4af70/"
The specified path is not of a legal form (empty).
I've committed the NuGet.exe and all related NuGet files that are under the .NuGet folder along with my project.
NOTE: The project was created under VS2013. It builds and runs fine under Xamarin Studio
Any ideas welcome.
do you have a .sln file for your solution? NuGet needs to find the .sln file to perform package restore. And in older version of NuGet, such error will be raised if .sln file cannot be found.
I've faced exactly the same problem. Finally, I've disabled NuGet package restore as a build step and decided to run restore separately:
wget http://nuget.org/nuget.exe
chmod +x nuget.exe
mono --runtime=v4.0 nuget.exe restore SolutionName.sln

Resources