Repository Management with Nexus - 2.12

Share

25.6. .NET Integration

Available in Nexus Repository Manager OSS and Nexus Repository Manager

25.6.1. Consume .NET Components from NuGet Gallery

The NuGet project provides a package and dependency management solution for .NET developers. It is integrated directly into Visual Studio and makes it easy to add, remove and update libraries and tools in Visual Studio and on the command line for projects that use the .NET Framework. Nexus Repository Manager can act as a proxy between your developer’s Visual Studio instances and the public NuGet Gallery.

When you configure Nexus Repository Manager to act as a proxy for NuGet Gallery you gain a more reliable build that depends on locally cached copies of the components on which you depend. If NuGet Gallery has availability problems, your developers can continue to be productive. Caching components locally will also result in a faster response for developers downloading .NET dependencies.

In this example, you will…

  • Configure your Visual Studio instance to download NuGet packages from your local repository manager.
  • Consume components from NuGet Gallery via Nexus Repository Manager.

Let’s get started

Your Nexus Repository Manager Trial instance has been preconfigured with the following NuGet repositories:

  • A Proxy Repository for NuGet Gallery
  • A Hosted Repository for your internal .NET components
  • A Group which combines both the NuGet Gallery Proxy and the Hosted NuGet Repository
figs/web/eval-nuget.png

Figure 25.8. NuGet Repositories in Repository List Accessed Using the List Filter Feature


To consume .NET components from Nexus Repository Manager you will need to install the NuGet feature in Visual Studio as referenced in Section 25.1.6, “Microsoft Visual Studio and NuGet” and configure it appropriately:

  1. Open Nexus Repository Manager, click on Repositories in the left-hand navigation menu and locate the NuGet Group repository group. This is the aggregating group from which Visual Studio should download packages. Click on this repository group in the list of repositories.
  2. Select the NuGet tab below the list of repositories with the NuGet Group selected and copy the URL in the Package Source field to your clipboard. The value should be http://localhost:8081/nexus/service/local/nuget/nuget-group/.
  3. Now in Visual Studio, right-click on a Visual Studio project and select Add Library Reference.
  4. In the Add Library Package Reference, click on the Settings button in the lower left-hand corner.
  5. This will bring up an Options button. Remove the initial NuGet repository location and replace it with a reference to your repository manager instance. Clicking Add to add the reference.
  6. Click OK to return to the Add Library Package Reference dialog.
  7. Select the Online item in the left-hand side of the dialog. At this point Visual Studio will interrogate your repository manager for a list of NuGet packages.
  8. You can now locate the package you need and install it.
  9. To verify that the NuGet package components are being served from Nexus Repository Manager you can return to the web interface and browse the local storage of your NuGet proxy repository.
[Note]

Watch this video of the steps being performed in Visual Studio.

The above instructions were created using Visual Studio 10 Web Developer Express. Your configuration steps may vary if you are using a different version of Visual Studio.

25.6.2. Publish and Share .NET Components with NuGet

Nexus Repository Manager can improve collaboration and control, while increasing the speed of .NET development. NuGet defines a packaging standard that organizations can use to share components.

If your organization needs to share .NET components, you can publish these components to a hosted NuGet repository on the repository manager. This makes it easy for projects within your organization to start publishing and consuming NuGet packages using Nexus Repository Manager as a central hub for collaboration.

Once NuGet packages are published to your repository manager instance they are automatically added to the NuGet repository group, making your internal packages as easy to consume as packages from NuGet Gallery.

In this example, you will…

  • Publish NuGet packages to a Hosted NuGet repository.
  • Distribute custom .NET components using Nexus Repository Manager.

Let’s get started:

  1. Follow the example from Section 25.6, “.NET Integration” to set up proxying of NuGet packages from the repository manager.
  2. Activate the NuGet API Security Realm → Read more…
  3. Create a NuGet Package in Visual Studio. Creating a package for deployment can be done with the pack command of the nuget command line tool or within Visual Studio. Detailed documentation can be found on the NuGet website.
  4. Publish a NuGet Package to Nexus Repository Manager → Read more…

25.6.3. Security

Integration with Enterprise LDAP Solutions

Available in Nexus Repository Manager OSS and Nexus Repository Manager

Organizations with large, distributed development teams often have a variety of authentication mechanisms, from multiple LDAP servers with multiple User and Group mappings, to companies with development teams that have been merged during an acquisition. Nexus Repository Manager’s Enterprise LDAP support was designed to meet the most complex security requirements and give administrators the power and flexibility to adapt to any situation.

Nexus Repository Manager offers LDAP support features for enterprise LDAP deployments including detailed configuration of cache parameters, support for multiple LDAP servers and backup mirrors, the ability to test user logins, support for common user/group mapping templates, and the ability to support more than one schema across multiple servers.

Let’s get started

Read more about configuring Enterprise LDAP to learn about the following:

  • Configuring LDAP caching and timeout.
  • Configuring and testing LDAP failover.
  • Using LDAP user and group mapping templates for Active Directory, POSIX with dynamic or static groups or generic LDAP configuration.

With Enterprise LDAP support in Nexus Repository Manager, you can do the following:

  • Cache LDAP authentication information.
  • Use multiple LDAP servers, each with different User and Group mappings.
  • Use LDAP servers with multiple backup instances and test the ability of Nexus Repository Manager to failover in the case of an outage.
  • Augment the roles from LDAP with Nexus Repository Manager specific privileges.

Integration with Atlassian Crowd

Available in Nexus Repository Manager only

If your organization uses Atlassian Crowd, Nexus Repository Manager can delegate authentication and access control to a Crowd server by mapping Crowd groups to Nexus Repository Manager roles.

Let’s get started

  1. Configure the Crowd Plugin → Read more…
  2. Map Crowd Groups to Nexus Repository Manager Roles → Read more…
  3. Add the Crowd Authentication Realm → Read more…

25.6.4. Enterprise Deployments

Available in Nexus Repository Manager only

Scaling Nexus Repository Manager Deployments for Distributed Development

Avoid downtime by deploying Nexus Repository Manager in a highly available configuration! With the Nexus Repository Manager feature Smart Proxy, two distributed teams can work with local instances of the repository manager that will inform each other of new components as they are published. Smart Proxy is an enhanced proxy setup with push notifications and potential prefetching of components. It allows you to keep proxy repositories on multiple repository managers in sync without sacrificing performance.

A team in New York can use a Nexus Repository Manager instance in New York and a team in Sydney can use an instance in Australia. If a component has been deployed, deleted, or changed, the source repository notifies the proxy. Both teams are assured that the repository manager will never serve stale content. This simple mechanism makes it possible to build complex distributed networks of repository manager instances relying on this publish/subscribe approach.

In this example, you will…

  • Setup two instances of Nexus Repository Manager.
  • Configure one instance to proxy the hosted instances of the other instance.
  • Configure the proxying instance to subscribe to Smart Proxy events.

Let’s get started

  1. Enable Smart Proxy publishing → Read more…
  2. Establish trust between repository managers → Read more…
  3. Configure Smart Proxy for specific repositories → Read more…