I'm using Visual Studio 2017 Professional, NCrunch 3.7.0.7. When I run my ASP.NET Core project in other test runners (e.g. ReSharper's, Visual Studio's), the tests run successfully. In NCrunch, however, the test run fails with the following exception:
Code:
System.IO.FileNotFoundException: Could not load file or assembly 'System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
at Microsoft.AspNetCore.Builder.JwtBearerOptions..ctor()
at WebApi.Authentication.AuthenticationBuilder.Configure(IApplicationBuilder app) in \src\WebApi\Authentication\AuthenticationBuilder.cs:line 44
at WebApi.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAccountsStore accountsStore) in \src\WebApi\Startup.cs:line 96
at CH360.Platform.WebApi.Tests.TestStartup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IAccountsStore accountsStore) in \test\WebApi.Tests\WebApiHost.cs:line 72
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build()
at Microsoft.AspNetCore.TestHost.TestServer..ctor(IWebHostBuilder builder)
at WebApi.Tests.WebApiHost..ctor() in \test\WebApi.Tests\WebApiHost.cs:line 22
at WebApi.Tests.WebApiSpecialHeaderAuthorizationFacts..ctor() in \test\WebApi.Tests\WebApiSpecialHeaderAuthorizationFacts.cs:line 18
The failing tests reference Microsoft.AspNetCore.TestHost v1.1.1 to run the ASP.NET MVC Core application in memory. A bit of digging indicates that `System.Xml.ReaderWriter` is part of the .NET Standard Library and doesn't need to be referenced directly. I've tried using CopyReferencedAssemblies in NCrunch Configuration to no avail.