System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Cryptography, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3 a' or one of its dependencies. The system cannot find the file specified

JAGADESWAR RAO DEVARASETTI 0 Reputation points
2023-05-24T09:33:08.9066667+00:00

Hi !!

i am working on .Net and python ,

so my task is to communicate or call c# functions in python using pythonnet library of clr package

i had created c# script along with functions and also able build sucessfully and run the code , got ouput as well..

but while i calling from python using pythonnet library

i am getting this error :

Traceback (most recent call last):
File ".\test.py", line 13, in
print(obj2.DecryptData(EncryptedText,Encryptionkey))
System.IO.FileNotFoundException: Could not load file or assembly 'System.Security.Cryptography, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3
a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Security.Cryptography, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Test2.Program.DecryptData(String EncryptedText, String Encryptionkey)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

dotnet details:
C:\Users\jjaga>dotnet --info
.NET SDK:
Version: 7.0.302
Commit: 990cf98a27

Runtime Environment:
OS Name: Windows
OS Version: 10.0.22621
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\7.0.302\

Host:
Version: 7.0.5
Architecture: x64
Commit: 8042d61

.NET SDKs installed:
7.0.302 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

can anyone please help what might be the solution

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,359 questions
0 comments No comments
{count} votes