How To Manually Re-Create A Nuget Package

How to manually re-create a nuget package ?

Issue Overview : There are some use cases, in which it becomes necessary to manually create a Nuget package from a pre-existing package. Usually this solution is used as a work around for getting past a dependency conflict that needs to be fixed by a Jira.

An example : If the UiPath.WebAPI.Activities 1.4.4 is used with the package UiPathTeams.Documents.TDDGenerator 1.4.7221.18964, the UiPathTeams.Documents.TDDGenerator uses NewtonSoft.json.dll version 12.03 but this version of NewtonSoft.json.dll is not compatible with UiPath.WebAPI.Activities 1.4.4.

In the above example, the dependency conflict can be circumvented by republishing the UiPathTeams.Documents.TDDGenerator with NewtonSoft.json.dll version 11.02.

To create the new package, perform the below:

  1. For this example we will be repackaging the UiPathTeams.Documents.TDDGenerator with NewtonSoft.json.dll version 11.02
  2. First, get a copy of the package. If the package has been used in a workflow, it can probably be found at %userprofile%\.nuget\packages\. Within the package directory, there will be a .nupkg for the package that needs to be modified.
    1. In this case the folder in question is located at: %userprofile%\.nuget\packages\uipathteam.documents.tddgenerator\1.4.7221.18964\uipathteam.documents.tddgenerator.1.4.7221.18964.nupkg
    2. The file can also be downloaded from UiPath Go.
    3. Copy this file to a working directory.
  3. In the working directory, change the file extension to “.zip” and then unpack it. This should create the following directory with the package contents: <working directory>\<package name and version>
    1. In this case this would be: <working directory>\uipathteam.documents.tddgenerator.1.4.7221.18964
  4. Open the directory and delete the following folders/files:
    1. “_rels”
    2. “package”
    3. “[Content_Types].xml”
    4. All that should remain is the “lib” folder and the “.nuspec” file.
  5. Open the .nuspec file
  6. Change the version of the package to the new package version. In this case, we would recommend change the version to something lower than the official version. This will prevent the package from being used in place of a future release.
    1. In our example, change the version to 1.4.7221.3000
    2. The version tag will be: <version>1.4.7221.18964</version>
    3. Change it to: <version>1.4.7221.3000</version>
  7. Save the file
  8. For our example, the NewtonSoft.json.dll file needs to be replaced with version 11.02
    1. Version 11.02 can probably be found at: %userprofile%\.nuget\packages\newtonsoft.json\11.0.2\lib\net45\Newtonsoft.Json.dll
    2. Copy this file and replace the one located at <working directory>\ uipathteam.documents.tddgenerator.1.4.7221.18964\lib\net461\Newtonsoft.Json.dll
  9. Make sure that nuget.exe is installed. If it is not installed, it can be downloaded from: https://www.nuget.org/downloads
  10. One the nuget.exe is downloaded it can be placed in C:\Windows\System32 or it can stay in the download folder. But if it is in the download folder, that path to the download folder needs to be specified when invoking the executable.
  11. Open a command prompt and change directories to the working directory.
    1. cd <working directory>
  12. Run the following command:
    1. Nuget.exe pack uipathteam.documents.tddgenerator.1.4.7221.18964
    2. If the nuget.exe was left in the downloads folder, it needs to be referenced as: <download folder>\nuget.exe
  13. This command will create the package. Try uploading it to Orchestrator.