Can we set NuGet URLs with domain policy - nuget

NuGet is just great addition for Visual Studio. And it also allows for custom NuGet repositories as long as you provide custom URLs to them.
For company-related projects we can have own NuGet repositories serving whatever libraries are needed for internal projects. The main problem is that each developer has to configure this manually within Visual Studio.
Question
Is it possible to set these URLs by domain security policy settings? This would be great, because every new team member that would install Visual Studio would automatically get these URLs and gettig project source code could automatically load related libraries (with the new NuGet feature that loads missing ones on build).
So #Haacked and Steve Sanderson... Is this possible?

NuGet 2.1 introduced hierarchical configuration settings for NuGet. This allows you to specify things like additional repositories at a project/solution level rather than having to have everyone receive the settings through a group policy.
Release notes: http://docs.nuget.org/docs/release-notes/nuget-2.1
By setting a NuGet repository at the solution level, everyone working on the solution will get the additional repository added to their package sources.

That is not yet possible. I'm pretty sure there's a feature request already for this in http://nuget.codeplex.com/. I recommend finding that feature and commenting on it. If you can't find it, start a discussion. :)

Related

Industry standard for managing Nuget packages within the enterprise

I have a situation where we have multiple C# projects that use similar set of Nuget packages (ex. Newton Json, Microsoft Compilers and CodeDom, Owin, log4net, jQuery, EntityFramework etc.)
I am trying to see how we can have a shared location for all Nuget packages to reduce the footprint of those binaries in Git, having a single repo for them by centralizing them in one place.
One option I found is to use Nuget.config in each project with repositoryPath set to point at the shared location. This works great for adding/upgrading/restoring Nuget packages in the project but it is not very clean when a package gets removed from one project but is still required in a different one. Basically the package will get removed from the shared location and the change is committed to Git, then when the other project requires it, it would get restored and added back to Git. Not a perfect solution in my mind.
I have a two part question:
1. Is there a way to improve the above workflow when packages get removed?
2. What is the industry standard for handling third party libraries delivered via Nuget? Or if there is none, can you share your experience handling Nuget packages across multiple projects.
If the concern lies with the footprint/organization of the Git repository, maybe you can do a .git ignore for the dependencies folders to prevent git from committing them into the repositories. When you need to build the projects from source, just do a dotnet /nuget restore to get the dependencies from the source you configured in the Nuget.config
Not sure if it is the industry standard, but we host our own Nuget server to control the libraries that the different teams can use. Microsoft has an article on Hosting your own NuGet feeds
Hope it helps.

Nuget: Good idea to check in package folder

I'm actually thinking about the pro and cons about using NuGet. In our current software we're storing each external reference in a common reference folder (which is commited to our SW versioning system). Over time this approach becomes more and more painful because we've to store different versions to the same library.
Since our devs are sometimes at the customer site (where not all customers are offering internet connectivity ...) we won't use NuGet directly, because NuGet packages can't be restored.
Based on that I'm actually thinking about using NuGet and store the packages folder in our SW versioning system.
Does anybody know if there are some disadvantages about this solution? Does anybody have a better proposal?
Thx.
I would argue against storing external nuget packages in your version control system.
It's not your application's responsibility to archive third party packages. Should you need to take care of that risk then build a solution intended for such (for example: use private nuget repository that's properly backed up).
Avoid duplication in code base - provided you use properly released packages, then the packages.config file content is sufficient for reliably reproducing the exact dependencies your application needs.
Synchronization is an effort - keeping packages.config and packages folder in sync- once you start including them in source control every developer working with packages would monitor and add or remove packages to source control.
If devs ever forget to add then local build still fails.
If they forget to remove no longer necessary piece then your downloadable set would contain junk.
VCS dataset size - storing them would needlessly enlarge your version control storage. Quite often the packages contain N different platform dlls, tools and whatnot which add up quite fast. Should you keep your dependencies constantly up to date, then after 10 years your VCS history would contain huige amount of irrelevant junk. Storage is cheap, but still..
Instead, consider having a private nuget repository with the purpose of serving and archiving the packages your application needs and set up your project to check your project nuget repository first. If your developers need offline compile support then they can set up project repository mirrors on their build boxes and configure the following fallback structure for repos:
Developer local project repository (ex: folder)
Shared project repository (ex: Nuget.Server)
(nuget.org)
A guide how to configure multiple repositories can be found here: How to configure local Nuget Repository.

Can I publish symbols to VSTS?

I'm currently publishing some NuGets to my VSTS feed. Is there support for VSTS acting as a Symbol Server as well so I can publish my symbol packages?
You can publish your symbols to a file share. There is not presently support for using VSTS itself as a symbol server.
It is now possible to use VSTS as a symbol server
I've also written a blog post on how to setup a symbol-server using a VSTS build definition where the symbols are published on a file share. It's actually more as a step-by-step guide on how to publish and expose them via IIS
Checkout Source Link. It is becoming a new standard or at least recommended way.
SourceLink is a language- and source-control agnostic system for providing first-class source debugging experiences for binaries. The goal of the project is to enable anyone building NuGet libraries to provide source debugging for their users with almost no effort. Microsoft libraries, such as .NET Core and Roslyn have enabled SourceLink. SourceLink is supported by Microsoft.
In a case of VSTS Git repository and .Net Core project
Add nuget reference of Microsoft.SourceLink.Vsts.Git to your project - the one which will be dotnet pack later (as of now in preview - make sure you tick "Include prereleases" in VS Nuget Manager)
Add <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> into PropertyGroup where the TargetFramework element is.
Add .NET Core task with command pack
The nuget package will now contain PDB files so you clients can easily debug your library.

How can I set up a code review process to my remote peers before checking in to TFS?

My development environment is set up behind a corporate proxy through remote VMs. We uses Visual Studio as the main platform for our code developement , so we had no issue with code review process as Team Foundation Server have this feature.
However recently, we switch to eclipse while still maintaining the projects in TFS. Eclipse have TFS plugin which is good as we can continue on from our previous track without much effort. The only thing missing is the code review.
So, is there anyone who worked using TFS and eclipse in offline mode behind a corporate proxy, have an alternative way to do code review just like visual studio + TFS.
It's based on which version control system your team are using.
If you are using GIT as source control.
For now, the Team Foundation Server plug-in for Eclipse (Team Explorer Everywhere) supports pull requests to review code and collaborate with members of your team.
Collaborate
Work and code together
Use pull requests to review code and collaborate with members of your
team. Triage and track comments at each stage of the work to ensure no
feedback gets lost. Finally, configure merge, build, and review
policies for your Git branches and stay up-to-date with alerts.
Source: Team Explorer Everywhere
If you are using TFVC as source control.
There is no this function in the plug-in directly. You may need to use 3-party code-review plugins to achieve it. Such as SonarLint, Checkstyle Plug-in...
If you want to enforce Code review before any checkin in TFS server. You may need to use check-in policies which can evaluate whether the pending changes meet the validation requirements before they can be checked in to the server. So, if the code review through Sonar can be called programmatically, then you can build a custom check-in policy that calls Sonar inside the Evaluate method.

Self-Hosting NuGet

I have been looking at self hosting NuGet, having a hard time understanding how to set it up and how it would help support our development process.
Does anyone have any recommendations as to which to use, how to set it up?
Or should I just use a hosted service?
After looking around at various solutions--self-hosted and hosted service--we chose to go with ProGet.
ProGet Summary
ProGet has a standard "free" license and nominal licensing fees (single year and perpetual) for the enterprise version. We currently use the standard "free" version and have no real complaints. You can create as many feeds as you want, add as many users as you want, etc. (We created "Testing", "Staging", and "Production" feeds to be part of our quality assurance process.) The only real limit in the free version is the inability to filter external feeds for specific packages you want included in your ProGet feeds. This filtering feature is managed with "connectors". With the enterprise version--when you create a feed--you can optionally add a "connector" to pull in packages from other feeds (external or internal).
ProGet With Nuget Package Management and Creation
The steps for creating a nuget package itself I'll leave to David Ebbo's popular blog post, http://blog.davidebbo.com/2011/04/easy-way-to-publish-nuget-packages-with.html. However, know that for uploading packages you can upload via the ProGet packages administration web UI, command-line nuget.exe, or the Nuget Package Explorer.
ProGet Installation, Configuration, and Activation
Installing, configuring and activating ProGet was the least intuitive part. It can install backed by a regular SQL Server database or a SQL Server Express db. Furthermore, it can also be a self-hosted app or run under IIS. If you need to perform offline activation or want to request different license keys go to my.inedo.com and create an account and you can do everything from there.
Proget Quality Control & CI
CI with TeamCity is something we are going to need so we are looking at creating a nuget package build process using TeamCity's Nuget server. There's a how-to for creating the packages I'll post in a comment. The next step would be to automatically publish the TeamCity-created nuget packages over to the appropriate ProGet feeds (ie. "Testing", "Staging", "Production") perhaps utilizing command-line Nuget with an API key.
Further Information
We looked at MyGet as a hosted service but it seemed to trip up on simple scenarios like adding another contributor/user. It also jumped quite a bit in price when needing more than just two contributor accounts. Whereas with ProGet you get unlimited user accounts with the free version alone.
One more side note: For publishing OSS type projects/packages, I'd take a look at Chocolatey as a solution.
Another option for self hosting is using the NuGet.Server package and creating an IIS website to host it on your internal network, although it won't scale very well if you plan to publish more than a handful of packages.
I've created a fork of NuGet.Server that uses a Lucene.Net index to fix these performance issues. Downloads are available from https://github.com/themotleyfool/Klondike/releases.
To keep this thread up-to-date, Visual Studio Team Services also has a package manager in preview. See the marketplace: Package Management
You can create an empty Asp.Net Web Application and install Nuget.Server from Nuget Gallery. This is a free option of self hosting your own Nuget packages on IIS. Check the documentation