dimanche 15 septembre 2019

Powershell. Get types from .net assembly returns Cannot resolve dependency to assembly 'System.Runtime, Version=4.2.1.0'

I have a .net project and I need to fetch list of method out of it using powershell, so I do

$testSuite = [System.Reflection.Assembly]::ReflectionOnlyLoadFrom("c:\dev\project\integrations-tests-poc\Container1.IntegrationTests\bin\Debug\netcoreapp2.2\Container1.IntegrationTests.dll")

Then when I'm trying to

$testSuite.GetTypes()

It returns

Cannot resolve dependency to assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.

I checked my nuget package storage, there aren't any package with this version and I cannot download it from anywherer. What am I doing wrong?





Aucun commentaire:

Enregistrer un commentaire