Архив метки: .net

Подключение .NET в программу на Python

Python .NET
PS C:\Users\user> C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe  -m pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pythonnet
Collecting pythonnet
  Downloading pythonnet-2.5.2-cp38-cp38-win_amd64.whl (81 kB)
     |████████████████████████████████| 81 kB 39 kB/s
Requirement already satisfied: pycparser in c:\users\user\appdata\local\programs\python\python38\lib\site-packages (from pythonnet) (2.20)
Installing collected packages: pythonnet
Successfully installed pythonnet-2.5.2
PS C:\Users\user> C:\Users\user\AppData\Local\Programs\Python\Python38\python.exe
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:59:51) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import clr
>>> from System import String

>>> from System import Math
>>> Math.Round(1.2346, 3)
1.235
>>>

c# Ошибка: System.TypeLoadException: Could not load type ‘System.Security.Claims.ClaimsIdentity’ from assembly mscorlib

c# Ошибка: System.TypeLoadException: Could not load type ‘System.Security.Claims.ClaimsIdentity’ from assembly mscorlib

Решение: установить .Net Framework 4.5

Как узнать .NET тип объектов в Powershell

В Powershell:

PS C:\Users\user> (Get-Acl c:).GetType() 
IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    DirectorySecurity                        System.Security.AccessControl.FileSystemSecurity