unable to delete Nuget package from TFS - Package Management feed - tfs

C:>nuget.exe delete Package1 1.0.0.0 -Source https://test.pkgs.visualstudio.com/_packaging/MyFeed/nuget/v2 -ApiKey VSTS
gives confirmation of package deleted
Package1 1.0.0.0 was deleted successfully.
However, when i refresh package management (TFS Web), the 'Package 1' package is still show up in the Web interface. It shouldn't show here because it has been deleted. Right?
Problem: I can't further push package.
Error:
Failed to process due to conflict.
Why so?

This link it says "Note: Unlisting is permanent. Once you unlist a version of a package, it cannot be re-listed.
You may not upload a package with the same name and version as the unlisted package."

Related

TFS nuget not restoring packages from a custom location

I'm using TFS 2013 and am trying to get the build process to run for the first time. I created a custom repository for a few libraries that do not have nuget packages under \\foundation\thirdparty. I then added this path to the tools-nuget package manager-nuget package manager settings-package sources and made sure that it's checked. On my local dev box it will download the custom repository and compile fine.
The build process has the following errors in it which are in my custom nuget targets:
Unable to find version '4.2.424.1509' of package 'License'.
Unable to find version '1.0.0' of package 'Oracle'.
I found the following articles already on here:
I added in the packageSource as specified here:
TFS2012 build server not restoring NuGet packages from in-house repository
And that did not work
In this article it referred to the nuget documentation
Restoring NuGet packages from custom Nugetserver using TFS Build 2015
nuget docs referral here:
https://docs.nuget.org/consume/nuget-config-file
Here it states that it will read from the VS setting under tools-options which does have the path already set.
I am running VS 2015 and TFS 2013 if that makes a difference...
Why won't the msbuild process download from my custom location?

xunit.core is incompatible with version of NuGet

I added a new project to the solution. I've added some nuget packages however it fails when building on TFS. It works fine when building locally. I get the following error messages:
C:\Builds\8\Server-Dev-CI\src\.nuget\NuGet.targets (58): The schema version of 'xunit.core' is incompatible with version 2.0.30828.5 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.
C:\Builds\8\Server-Dev-CI\src\.nuget\NuGet.targets (58): The schema version of 'xunit.extensibility.execution' is incompatible with version 2.0.30828.5 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942.
C:\Builds\8\Server-Dev-CI\src\.nuget\NuGet.targets (58): One or more errors occurred.
C:\Builds\8\Server-Dev-CI\src\.nuget\NuGet.targets (58): The command ""C:\Builds\8\Server-Dev-CI\src\.nuget\nuget.exe" install "C:\Builds\8\Server-Dev-CI\src\Modules\UnitTests.xUnit\packages.config" -source "https://nuget.org/api/v2/" -o "C:\Builds\8\Server-Dev-CI\src\packages"" exited with code 1.
When I open the sources in VS2013 (on the build server) I see the following:
I have to click Restore Packages to get it to work.
I already updated NuGet. Where is it getting " 2.0.30828.5 of NuGet" from???
I figured it out. The whole time I though TFS uses Visual Studio's NuGet, however it turns out TFS runs:
C:\Program Files\Microsoft Team Foundation Server 12.0\Tools\nuget.exe restore
I had to open up console and update nuget:
nuget.exe update -self

TFS204018 error when installing NuGet Package in VS2015

Whenever I install a NuGet package in a TFS source-controlled VS 2015 project, I get a message similar to the following output under "Source Control - Team Foundation":
TF204018: Could not check the file's encoding because the file C:\TFS\Oz.Interfaces\Main\Source\MVRSTamperCodes\MVRSTamperCodes.Web\web.config is in use.
I've been searching fruitlessly to see if there's a way to fix this issue and haven't found anything yet. Does anyone know what is causing this message and/or what steps I can take to fix it? I should note that this doesn't prevent the successful installation of the NuGet package so it appears to just be a warning or informational message.
I've met similar issue with blocking web.config and other files. My solution was:
Uninstall NuGet Package Manager (Tools -> Extensions and Updates)
Install newest version (currently: Nuget 3.2)
If you're using Team Foundation Server, you will need to first check out the entire project, before updating Nuget Packages for the project, if you have this problem.

How to ensure TFS build server gets updated Nuget packages

I have an ASP.NET MVC website that was using the pre-release bits of Application Insights. I used the 'Manage Nuget Packages' option on the website to upgrade Application Insights to the latest version. Everything builds and runs successfully locally. All the App. Insights DLLs have been updated to v1.1.0. However when I try to run a gated build on TFS to check these changes in I keep getting the following error:
This project references NuGet package(s) that are missing on this
computer(here it's pointing to the build server). Enable NuGet Package
Restore to download them. For more information, see
http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is
....\packages\Microsoft.ApplicationInsights.Agent.Intercept.0.17.0\build\Microsoft.ApplicationInsights.Agent.Intercept.targets.
This only happens when the gated build runs on trying to check in. It results in the gated build failing which rejects my checking.
Is there anything that I can do here?
Looking at the error i believe , you have not enabled automatic package restore option.
please enable this option to resolve the error , while nuget restore works.
Steps to enable :
Click on Tools -> Nuget Package Manager -> Package Manager Settings -->general --> check the option Automatically restore package while building .
This feature will download all packages which are referred by your packages.config files before building the code to make sure code has all references included while building the code.

VisualStudio 2013 list all NuGet packages

I have a mvc 5 web project with a number of NuGet packages installed (like email, log, pagedlist etc).
In a new similar project I would like to install the same NuGet packages. How can I in the old project list all installed NuGet packages?
You can find a packages.config file in the old project's root directory.
You can copy it to the new project.
If you go to Tools -> NuGet Packet Manager -> Packet manager settings and check Allow NuGet to download missing packages and the other check box that states Automatically check for missing packages during build in Visual Studio it will download it for you next time you build.
If you want to list all installed nuget packages for the project take a look at this one.
http://blogs.msdn.com/b/david_kidder/archive/2014/08/19/micro-blog-how-to-list-installed-nuget-packages-from-package-manager-console-and-be-able-to-read-them.aspx
You might also want to enable nuget package restore to restore the packages when rebuilding your project/s.
Here's another link for you - http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
In the root folder of your original project find a packages.config file. Copy its contents to your new project, same file name.
Go to Visual Studio > Tools > Package Manager Settings > General
Enable "Allow Nuget to download..." and "Automatically check for missing..."
Now build your new project
Most of the answers here are partially correct.
The first part is true. The packages.config file lists all packages that are used by the project.
However, all the answers about using Package Restore are incorrect. Package Restore will download any missing packages, however it is NOT the same as installing a package into a project. It will not add references, run any install.ps1 scripts, or add files, modify .config, etc. Package Restore simply downloads missing packages. It is assumed that the packages were already installed to the project.
In order for the packages to be correctly installed in your new project, open the Package Manager console, then type:
Update-Package -ProjectName MyProjectName -Reinstall
This will force NuGet to run through the install process and correctly install the package into your project.

Resources