3

We have a NuGet package in Azure Artifacts which we would like to use in our Python code. We are able to use DLLs and also assemblies from NuGet library, in Python but here we would specifically like to use NuGet package which another team built and deployed on Azure Artifacts.

Following is the code we have been able to write so far:

import clr
import unittest

clr.AddReference("System.Security.Cryptography.Algorithms")

def test(self):
    self.assertTrue(issubclass(type(System.Security.Cryptography.MD5.Create()),System.Security.Cryptography.MD5))

unittest.main()
Shidouuu
  • 368
  • 4
  • 14
  • Are you using Docker? If it is, check this question: https://stackoverflow.com/questions/61099159/azure-devops-install-python-package-from-azure-artifacts-inside-docker – Doris Lv Mar 19 '21 at 10:12

1 Answers1

3

You need to install the packages using NuGet command line, copy required .dll files to your project folder, and then add reference using clr.AddReferenceToFile('filePathToPackageDll').

nuget sources add -Name <SourceName> -Source <SourceURL> -username <UserName> -password <Pat>
nuget.exe restore
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39