dimanche 1 septembre 2019

Missing assemblies when reflecting into unit test project

When reflecting into a unittests assembly (System.Reflection.Assembly.GetTypes()) from a console app I get a slew of file not found errors.

I tried adding a bunch of packages with minimal success, I'm unsure that is the way to go.

This is my project file.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>

    <IsPackable>false</IsPackable>   
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="FluentAssertions" Version="5.9.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
    <PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
    <PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
    <PackageReference Include="PossumLabs.Specflow.Core" Version="1.0.0-CI00024" />
    <PackageReference Include="PossumLabs.Specflow.Selenium" Version="1.0.0-CI00030" />
    <PackageReference Include="Selenium.Chrome.WebDriver" Version="74.0.0" />
    <PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
    <PackageReference Include="SpecFlow" Version="3.0.225" />
    <PackageReference Include="SpecFlow.MsTest" Version="3.0.225" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.0.225" />
    <PackageReference Include="System.Text.Encoding.CodePages" Version="4.5.1" />
 </ItemGroup>

</Project>

Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Same goes for

Microsoft.VisualStudio.TestPlatform.TestFramework
Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.Interface
Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices
Microsoft.VisualStudio.TestPlatform.ObjectModel
Microsoft.VisualStudio.TestPlatform.TestFramework

I want to get these to copy to my output folder so that I can reflect into the unittest DLL.





Aucun commentaire:

Enregistrer un commentaire