How to decrypt the nugget package(library) to readable code in .net or Visual Studio (Readable code)?

Hi All,

I have nugget package (library) for my custom code from UiPath.

I am trying to make this nugget package compatible with windows version, so I was thinking to install Visual Studio Code and decrypt the nugget package to view the code and make this code compatible with the Windows version. Is this the right way to make my nugget package compatible with windows or How can we achieve this?

Any help would be appreciated.

BR,
NK

If you don’t have the .Net461 original code of your Dll file in VS Studio, you can use the JetBrains dotPeek to inspect and get the backend code of the dll library files.

Then you can create a new .Net6 library in VS Studio using the most majority of the old code.

1 Like

Hey @Nitesh ,

To address your question about making a UiPath custom activity NuGet package compatible with the Windows version and accessing the underlying code, here’s a step-by-step guide:

Important Note:

NuGet packages are usually built from source code, but once compiled, they do not contain the original source code (like .cs files). Instead, they contain compiled DLLs. Thus, “decrypting” a NuGet package means extracting and decompiling the DLL files to view the source code.

Step-by-Step Solution:

Step 1: Extract the NuGet Package

  1. Download the .nupkg file (NuGet package) if you haven’t already.
  2. Rename the .nupkg file to .zip.
    • Example: Rename MyPackage.nupkg to MyPackage.zip.
  3. Extract the .zip file using any archive tool (e.g., WinRAR, 7-Zip). This will give you access to the package contents, which include .dll files and other resources.

Step 2: Decompile the DLLs

To view the code within the extracted DLLs, you can use one of the following tools:

  1. Use ILSpy (Free Tool):

    • Download and install ILSpy.
    • Open ILSpy and drag & drop the DLL file from your extracted NuGet package.
    • It will decompile the DLL and show you the readable .cs code.
  2. Use dotPeek (Free Tool from JetBrains):

    • Download and install dotPeek.
    • Open dotPeek and load the DLL file.
    • It will display the decompiled source code.
  3. Use Visual Studio:

    • Open Visual Studio.
    • Go to File > Open > File... and select your DLL file.
    • Right-click on the loaded assembly and select “Go to Definition”. This will use the built-in decompiler to show the code.

Step 3: Make Your Code Compatible with Windows Version

  1. Create a New Project:

    • Open Visual Studio.
    • Create a new project of type Class Library (.NET Framework) or Class Library (.NET) if you are targeting Windows Compatibility.
    • Set the Target Framework to .NET 6 or higher (depending on your UiPath version).
  2. Migrate the Decompiled Code:

    • Copy the decompiled code (from Step 2) into your new Visual Studio project.
    • Update any dependencies or namespaces as needed.
  3. Add UiPath Activity Dependencies:

    • Use the NuGet Package Manager to add the required UiPath Activity libraries (e.g., UiPath.System.Activities, UiPath.UIAutomation.Activities).
    • Adjust any code for compatibility with the Windows compatibility pack if needed.
  4. Build Your Project:

    • Build your project to generate a new DLL compatible with the Windows version.
    • You can now package this new DLL into a new .nupkg file using nuget.exe or Visual Studio.
  5. Deploy the Updated Package:

    • Publish the updated NuGet package to your local or Orchestrator feed so that it can be used in your UiPath projects.

Summary

  • Extract the .nupkg file.
  • Decompile the DLLs using ILSpy, dotPeek, or Visual Studio.
  • Modify and recompile the code using Visual Studio for Windows compatibility.
  • Create a new .nupkg package with the updated code.

I hope this helps! Let me know if you need further clarification. :blush:

Best,
Chaitanya

1 Like

Please mark this as the solution if it helps! :blush:

@Nitesh

thats the way

and here is the video describing the same

cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.