Razor engine not finding views

Solution 1:

It seemed that it was looking in the source directory instead of the actually executing assembly folder. I fixed it by changing the first line of the FindView method to the following:

var dir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
var getViewResult = _viewEngine.GetView(executingFilePath: dir, viewPath: viewName, isMainPage: true);