Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default view location #29

Closed
wants to merge 1 commit into from
Closed

Fix default view location #29

wants to merge 1 commit into from

Conversation

NRKirby
Copy link

@NRKirby NRKirby commented Jul 16, 2018

I just tried using your package on a new project I've created.

My Features directory hierarchy is:

Features
-- Account
    -- AccountController.cs
    -- Register.cshtml
...

I've added feature folders in Startup.cs like this:

services
  .AddMvc()
  .AddFeatureFolders()
...

In the current implementation of this package, when I browse to the Register view I get the following error:

InvalidOperationException: The view 'Register' was not found. The following locations were searched:
\Register.cshtml
Features\Shared\Register.cshtml
\Features\Register\Account.cshtml

In FeatureFolderOptions.cs the DefaultViewLocation is defined as:

DefaultViewLocation = @"\Features\{0}\{1}.cshtml";

I think it should be the other way round:

DefaultViewLocation = @"\Features\{1}\{0}.cshtml";

I've made the change in this PR. Apologies if I've misunderstood how to use your library. If that's the case, maybe you could let me know how I should use it?

Nick

@aabenoja
Copy link

What is the namespace of your AccountController? I've been able to reproduce your issue in this repo, which I then fixed by updating my namespaces.

The convention works by analyzing the controller namespace. If you 're using the default [ProjectName].Controller namespace that's probably the cause. From what I can tell (in my example repo, at least) the DefaultViewLocation is working just fine.

@NRKirby
Copy link
Author

NRKirby commented Jul 17, 2018

Ahh, that fixes it.

Thanks for your help. I will close this PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants