Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Could not load file or assembly 'xunit.runner.utility.netstandard15
mmisztal
#1 Posted : Saturday, June 1, 2019 10:14:33 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I'm working on a netcore2.2 based solution. When NCrunch is enabled, all test projects fail to build with an exception:

Code:

An error occurred while analysing this project after it was built: System.IO.FileNotFoundException: Could not load file or assembly 'xunit.runner.utility.netstandard15, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'. The system cannot find the file specified.
File name: 'xunit.runner.utility.netstandard15, Version=2.2.0.3545, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'
   at nCrunch.Module.XUnit2.Integration.XUnit2DiscoveryEnvironment.<>c__DisplayClass2_0.<FindFrameworkTestsInAssembly>b__1()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Module.XUnit2.Integration.XUnit2DiscoveryEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
   at nCrunch.TestExecution.TestFinder.<>c__DisplayClass2_2.<FindTestsForFrameworks>b__2()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.TestExecution.TestFinder.<>c__DisplayClass2_0.<FindTestsForFrameworks>b__0()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
   at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker)


Below is a sample .csproj from one of the test projects

Code:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>    
    <LangVersion>7.3</LangVersion>
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
    <IsPackable>false</IsPackable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.reporters" Version="2.4.1" />
    <PackageReference Include="xunit" Version="2.4.1" />    
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <ProjectReference Include="..\..\..\..\core\core-pkg\src\Core.Testing\Core.Testing.csproj" />
    <ProjectReference Include="..\..\..\core-http-pkg\src\Core.Http\Core.Http.csproj" />
    <ProjectReference Include="..\..\src\Core.Http.Consul\Core.Http.Consul.csproj" />
  </ItemGroup>

  <ItemGroup>
    <None Update="IntegrationTests\service-discovery-consul-settings01.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>


Are there any issues when working against .net core 2.2? Why is NCrunch expecting a .NET Standard 1.5?
Remco
#2 Posted : Saturday, June 1, 2019 11:07:29 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,681

Thanks: 737 times
Was thanked: 944 time(s) in 899 post(s)
Hi, thanks for sharing this issue.

Could you check the following?

- If you have any binding redirections in place, could you try removing them to see if this changes anything

- Could you try removing the reference to xunit.runner.visualstudio to see if this changes anything

- Could you try creating a small sample project that references only the latest version of Xunit and contains only one test, to see if this works? This will help establish if the problem is on your machine or in the solution itself.
mmisztal
#3 Posted : Sunday, June 2, 2019 7:27:39 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco,

As far as I can tell I'm not 'conciously' using any binding redirects, nor is automatic generation enabled in the .csproj files.

I've created a new solution with a single XUnitProject, my instance of VS2019 defaulted to a preview version of .net core 3.0:

Code:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>

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

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.0-preview-20181205-02" />
    <PackageReference Include="xunit" Version="2.4.0" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
  </ItemGroup>

</Project>


This has worked, and NCrunch has successfully initialized, built and run the test assembly.

I've changed the project to target .net core 2.2 and use the same versions of XUnit as my originally failing project(s):

Code:

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

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

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

  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
    <PackageReference Include="xunit" Version="2.4.1" />
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
  </ItemGroup>
</Project>


NCrunch has succesfully reloaded, rebuilt and re-run the test assembly.
I'm not sure what's wrong here.
Remco
#4 Posted : Sunday, June 2, 2019 11:20:01 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,681

Thanks: 737 times
Was thanked: 944 time(s) in 899 post(s)
Inside any sample project, could you try introducing a package reference to the xunit.runner.utility Nuget package, then build the project? This will cause Nuget to ensure the package is downloaded and installed on your machine. NCrunch should normally restore this package automatically and it should warn you if it wasn't able to do so.

If the above doesn't work, could you try introducing a package reference to the xunit.runner.utility package from inside the test project encountering the problem?

If neither of the above work, I might need to ask for a sample project from you that can reproduce this problem so that I can investigate it further. You're welcome to submit any code samples through the NCrunch contact form.
mmisztal
#5 Posted : Thursday, June 6, 2019 1:20:26 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi Remco,

I've uploaded a sample solution to a private GitHub repo and added you as a collaborator: https://github.com/mmisz...ard15-repro/invitations
Just checked - still fails.
Remco
#6 Posted : Friday, June 7, 2019 4:16:36 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,681

Thanks: 737 times
Was thanked: 944 time(s) in 899 post(s)
1 user thanked Remco for this useful post.
mmisztal on 6/7/2019(UTC)
mmisztal
#7 Posted : Friday, June 7, 2019 4:38:37 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/17/2013(UTC)
Posts: 8
Location: Poland

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
The new build works fine. All assemblies are being loaded and tests are being executed as expected. Thank you Sir.
1 user thanked mmisztal for this useful post.
Remco on 6/7/2019(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.044 seconds.