I have a ASP.NET Core project with some simple Razor pages and a Web API controller.
I\'m using Clean Architecture as a starting point. I\'ve renamed the project names,
This method worked for me
var client = _factory .WithWebHostBuilder(builder => builder.UseSolutionRelativeContentRoot("relative/path/of/project/under/test")) .CreateClient();
See How the test infrastructure infers the app content root path for more information.