Nancy testing project can't find views

坚强是说给别人听的谎言 提交于 2019-12-05 06:50:48
TheCodeJunkie

The problem is that the views aren't anywhere close your test project, and since the IRootPathProvider is pointing at the wrong place, it can't find them. Two ways to get around this is use the ConfigurableBootstrapper (which is more or less the same as the Default one, but the the possibility to override stuff when initialized) and tell it to use your custom root path provider

var bootstrapper = new ConfigurableBootstrapper(with => {
    with.RootPathProvider<CustomRootPathProvider>();
});

You would then implement public class CustomRootPathProvider : IRootPathProvider and point it in the right place.

The second solution would be to set your views to always copy to the output directory, I believe that should also solve it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!