VSO Package Library - Nuget Delayed - visual-studio-2017

Our team has a private Package Feed set up in Visual Studio Online. We can push the latest version of a library we are working on to the feed, and then see it in our NuGet package manager in VS2017.
In the last few weeks, this process has become unreliable, and we cannot determine why.
Steps:
A developer builds nuget a package locally.
We push the package to our feed using the command line
nuget.exe push -Source "VSO-Feed" -ApiKey VSTS ..\Project\bin\Debug\Project.0.1.1-alpha.nupkg
Command returns success
We can see new new package version under "Packages" in VSO
NuGet Package Manager in VS 2017 cannot find the new package
Attempts to update the .csproj file manually to reference the new version sometimes succeed, but just as frequently the project build fails with a message like
Unable to find package Project with version (>= 0.1.1-alpha)
Found 243 version(s) in vso-feed [ Nearest version: 0.1.0-alpha ]
After an indeterminate period of time, usually at least 45 minutes, it suddenly works again!
Has anyone else experienced this? Our searches have come up empty.

Related

Visual Studio 2017 Nuget Install Package Builds Project Instead of Installing / Uninstalling Packages

When importing existing library projects into an existing solution (after I copied them locally from somewhere else), when I try to install or uninstall a Nuget package through the package manager, it justs builds my solution showing me all of the errors I have because the package is not installed. It does nto try to install or uninstall the package. Why is it building my project instead of just installing / uninstalling the bloody package?
Why is it building my project instead of just installing /
uninstalling the bloody package?
It's not default behavior of VS IDE itself.
As for VS2017, if we install a normal package using Package Manager UI, VS will check the compatibility between the package to consume and the current project. If they're compatible, the package will be installed successfully, if not, VS will throw nuget error like NU1202 or others in ErrorList window.
But I'm sure for VS2017, installing/uninstalling won't call a build.
Possible causes of the issue and corresponding suggestions:
1.This behavior results from one third-party extension.
Reset all VS settings => disable all the third-party extensions => restart VS to check if the issue persists. If after the check you find this issue results from one extension, you need to make sure if the extension provides one option to turn on/off the auto-build. Or you may need to disable/uninstall the extension temporarily and contact the author of the extension to post the issue.
You may get more details for trouble-shooting from this similar issue.
2.Custom script(.ps1,.targets) from one specific nuget package causes this.
The authors can place powershell script and PackageID.targets in .nupkg when generating packages. Some of these scrips will execute when we install the package, others will execute when we uninstall the package. See similar issue here.
You can create a new simple console project TestProject in TestProject solution. Then right-click solution=>add=>Existing project to import a new external project. Now let's install the Newtonsoft.Json package to check if the issue disappears. If the issue disappears in new project with Newtonsoft.Json package. I think it indicates one special package you try to install/uninstall may cause the issue.
Hope all above helps and feel free to let me know if there's any update.

Nuget install faill because of a path which is to long

I'm trying to install some Package on Visual Studio 2017 using NuGet, I need the Microsoft.EntityFrameworkCore package but when I try to install, it fails because of a long path/repertory name. This path is supposed to be shorter than 260 chars (or 248 if it's a repertory name), but I can't figure out which path/repertory they're talking about (there is no more info in the error). So I did look to my C# project Path and this one is only 130 chars.
Do you have any solution ? I'm on a school project and I really need these packages , hope you guys can help me.
Nuget install faill because of a path which is to long
When we install the nuget package via NuGet to our project, NuGet will download the package from the nuget source and save it in the local cache.
For .net framework project, NuGet will save the package in the \packages folder in the solution folder by default. In this case, if we have the long file name issue, we could move the solution to the root of C disk, just like magicandre1981 said.
Besides, if you are interested in nuget, we could overwrite the repositoryPath value in the nuget.config file to change the default path of \packages folder.
Check details from this thread and the document.
For .net core/standard project, NuGet will save the package in the global folder C:\Users\<UserName>\.nuget\packages. In this case, if we have long username, we may get this issue, to resolve it, we could rename our username or we could change the default global package folder.
Check this thread for details.
Hope this helps.

Illegal characters in path when NuGet tries to remove old package from packages folder

Suddenly I'm getting an error when trying to update NuGet packages (or doing anything with NuGet packages). The error says it has something to do with the path but the path has not changed. Does anyone recognize this?
I'm using Visual Studio Enterprise 2017 version 15.8.5
Below is a copy of the output from Package Manager. The update was triggered manually from the "Manage NuGet Packages for Solution..." dialog.
It looks like the new version of the package is successfully installed. The problem occurs when the old package is to be removed from the packages folder.
Found package 'GenericParser 1.1.6' in 'C:\vsts\FLOTT\Main\packages'.
Removed package 'GenericParser 1.1.5' from 'packages.config'
Successfully uninstalled 'GenericParser 1.1.5' from Flott.App
Package 'GenericParser.1.1.6' already exists in folder 'C:\vsts\FLOTT\Main\packages'
Added package 'GenericParser.1.1.6' to 'packages.config'
Successfully installed 'GenericParser 1.1.6' to Flott.App
Removing package 'GenericParser 1.1.5' from folder 'C:\vsts\FLOTT\Main\packages'
Illegal characters in path.
System.ArgumentException: Illegal characters in path.
at System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
at System.IO.Path.GetFileName(String path)
at Microsoft.TeamFoundation.Common.FileSpec.GetFullPath(String path, Boolean checkForIllegalDollar)
at Microsoft.TeamFoundation.VersionControl.Client.Client.GetLocalWorkspace(String localPath, Boolean throwIfNotFound)

Issue with updating NuGet packages (VS2017)

Visual Studio 2017 - Saying "Package restore failed" while updating the NuGet packages as following:
Issue with updating NuGet packages (VS2017)
To resolve this issue, first, you should make sure your Target Framework that is used to compile your android application, Use Latest Platform (Android 8.1 (Oreo)).
Check source: Understanding Android API Levels
Second, if you confirm your Target Framework is Android 8.1 (Oreo), then Select all packages checkbox, and click Update button:
After that, all nuget packages can be updated to latest version.
The reason for this issue:
To find the reason for this issue, change the MSBuild build log to Detailed, Tools->Options->Projects and Solutions->Build and Run->MSBuild project build output verbosity:Detailed.
When you update one of those default nuget packages, in the output you will get following dependencies conflict errors:
NU1107: Version conflict detected for Xamarin.Android.Support.Compat.
Reference the package directly from the project to resolve this issue.
App1.Android -> Xamarin.Android.Support.Design 27.0.2 ->
c (= 27.0.2) App1.Android ->
Xamarin.Android.Support.v7.AppCompat 25.4.0.2 ->
Xamarin.Android.Support.Compat (= 25.4.0.2).
That means when you update the default package Xamarin.Android.Support.Design to 27.0.2, one of its dependencies, Xamarin.Android.Support.Compat also need to be updated to 27.0.2. However, other nuget package Xamarin.Android.Support.v7.AppCompat 25.4.0.2 still reference the Xamarin.Android.Support.Compat with the old version 25.4.0.2. So you will get that error.
To resolve this error, you should update all default package at once instead of one of them.

Package X is not compatible with netstandard2.0

I created a .NET Standard v2.0 project in Visual Studio 2017 v15.3.1 and I'm unable to install "Microsoft.EntityFrameworkCore 2.0.0" package in it (by Nuget 4.3). Previously the .NET SDK and Runtime, both 2.0.0, were installed.
The errors I get follow this pattern:
"Package X is not compatible with netstandard2.0 (.NETStandard,Version=v2.0)." (i.e. System.Reflection.TypeExtensions 4.1.0).
What could it be causing these errors?
EDIT: I'll show the exact warnings and errors with an example (there are too many).
Restoring packages for [.csproj path]...
Warning:
Package "System.Collections 4.3.0" was restored using ".NETFramework,Version=v4.6.1" the project target framework ".NETStandard,Version=v2.0". This may cause compatibility problems.
...
Error:
Package Remotion.Linq 2.1.1 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Remotion.Linq 2.1.1 supports:
net35 (.NETFramework,Version=v3.5)
net40 (.NETFramework,Version=v4.0)
net45 (.NETFramework,Version=v4.5)
netstandard1.0 (.NETStandard,Version=v1.0)
portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
...
Error restoring package. Reverting package changes for 'ClassLibrary1'.
Time elapsed: 00:00:02.4689637
========== Ended ==========
Clicking the "Clear all Nuget Caches" will resolve issue.
Issue solved installing, independently, newer versions for each of the packages' dependencies which were showing error, so that the big package "Microsoft.EntityFrameworkCore 2.0.0" gets installed at last.
Hope it helps.
Edited: It happened to me another time and tried a faster solution. The key was deleting Nuget's cache from the packages' manager configuration.