Transition from Legacy Artifact Folders to NuGet Packages

Overview

This article aims to discuss the transition from legacy artifact folders to NuGet packages for distribution of The Portal Connector. This is one of the most highly requested process improvements, and rightfully so. There are several benefits that come with the utilization of NuGet packages. Some of these improvements include:

  • Dependency Management
  • Automatic Binding Redirects (Depends on Project Settings)
  • Automatic Assembly References
  • Easier Package Installation and Updates
  • Improved Package Retention
  • Improved Source Control Integration
  • Improved Application Stability

Setup

The first step that will need to be done to utilize The Portal Connector NuGet packages is to add The Portal Connector’s public NuGet feed. Currently the public feed is located at the following address: https://nuget.portalconnector.com/index.json. This feed can be added inside Visual Studio’s Package Sources settings, or directly to a NuGet.config file for integration pipelines.

Adding NuGet Feed in Visual Studio

  1. Inside Visual Studio navigate to Tools > NuGet Package Manager > Package Manager Settings.

    NuGetPicture1

  2. Under the Heading NuGet Package Manager, click Package Sources.
  3. Click the + Button to add a new Package Source.

    NuGetPicture3

  4. Click on the new Package source that was added to the list. Add the following values:

    Name: The Portal Connector

    Source: https://nuget.portalconnector.com/index.json

  5. Click OK.

    Picture5

Adding NuGet Feed to NuGet.config

  1. Under the configuration > packageSources element add the following element:
<packageSources>
    ...
    <add key="Portal Connector" value="https://nuget.portalconnector.com/index.json" />
</packageSources>

Installation/Updates

Once you have added The Portal Connector package source, you are ready to install or update using Nuget Packages!

  1. Right click on your project in Visual Studio and select Manage NuGet Packages…

     NuGetInstall1

  2. In the NuGet window Change the tab to Browse, and make sure the Package Source is set to All or The Portal Connector.

    NuGetInstall2

  3. Search for PortalConnector, you should see a list of all available Portal Connector library packages.
  4. Find the PortalConnector.All package that matches your current TPC and Sitefinity version and click the Install button. If you are developing against a class library rather than a Sitefinity site, you can install the PortalConnector.Core package.

    NuGetInstall3

    The Portal Connector package versions follow a standard convention. We can look at the following example to understand that convention.

    Example: PortalConnector.All - 6.2.130.101

    6.2 – This indicates that the package is for The Portal Connector version 6.2.

    130 – This indicates that the package is for Sitefinity 13.0 (Any patch version).

    101 – This indicates that the package is Revision 101.

  5. Once the package has been installed to your Sitefinity project, Rebuild your solution in Visual Studio. The project should be ready to run!

Common Issues

One of the most common issues you may experience when upgrading to The Portal Connector NuGet packages is that some manual binding redirects may not be automatically removed. This is a result of manually inputting binding redirects into the web.config file that do not correspond to existing NuGet packages. An example of what that may look like can be seen below:

NuGetIIssues1

In the case that you experience binding exceptions during compile or runtime, the easiest troubleshooting step is to completely remove the binding redirect for the problem assembly. For the example screenshot above, we remove the following lines from the web.config file for the Microsoft.SharePoint assemblies.

<dependentAssembly>

    <assemblyIdentity name="Microsoft.SharePoint.Client" publicKeyToken="71e9bce111e9429c" culture="neutral"/>

    <bindingRedirect oldVersion="0.0.0.0-16.1.0.0" newVersion="16.0.0.0"/>

</dependentAssembly>

<dependentAssembly>

    <assemblyIdentity name="Microsoft.SharePoint.Client.Runtime" publicKeyToken="71e9bce111e9429c" culture="neutral"/>

    <bindingRedirect oldVersion="0.0.0.0-16.1.0.0" newVersion="16.0.0.0"/>

</dependentAssembly>

Once these lines have been removed, the project builds successfully! 😊

In the case that the project is still throwing exceptions even after the binding redirect has been removed from the web.config, it likely means that the binding redirect is still required but is no longer valid (indicating that the final assembly in the bin no longer matches the newVersion element, or the oldVersion version range is no longer adequate).

If you are experiencing problems with binding redirects that are not easily resolved, please reach out to support@crmportalconnector.com and we will help you to complete the upgrade!

Additional Documentation

Installing The Portal Connector Using NuGet Packages:

Installing The Portal Connector on Sitefinity 14 (NuGet)

Installing The Portal Connector on Sitefinity 13 (NuGet)

Upgrading The Portal Connector Using NuGet Packages:

Upgrading from TPC 6.0 to TPC 6.1 (NuGet)
Upgrading from TPC 5.3 to TPC 6.0 (NuGet)
Upgrading from TPC 5.2 to TPC 5.3 (NuGet)
Upgrading from TPC 5.1 to TPC 5.2 (NuGet)