Skip to content

FileProviders MvcRazorRuntimeCompilationOptions vs RazorViewEngineOptions #14221

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

Closed
DiegoStefanon opened this issue Sep 21, 2019 · 10 comments
Closed
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question

Comments

@DiegoStefanon
Copy link

Describe the bug

in core 3.rc1 is not working anymore ->
services.Configure<MvcRazorRuntimeCompilationOptions>(opts =>
opts.FileProviders.Add(fp)
);

in core 2.2 was good ->
RazorViewEngineOptions FileProviders.Add was working

Expected behavior

In asp.net core 3 rc1
RazorViewEngineOptions has no more FileProviders property
so using the new one MvcRazorRuntimeCompilationOptions is not working anymore

Thanks

@DiegoStefanon
Copy link
Author

I have discovered that in order to work I have to deactivate other services, ok

@dn32
Copy link

dn32 commented Sep 23, 2019

I have discovered that in order to work I have to deactivate other services, ok

I'm experiencing the same problem and couldn't understand your solution. Can it be any clearer?

@DiegoStefanon
Copy link
Author

DiegoStefanon commented Sep 23, 2019

Yes, it does not work anymore as in last net core 2.2 was good ->
RazorViewEngineOptions FileProviders.Add (was working)

In asp.net core 3
RazorViewEngineOptions has no more FileProviders property
so using the new one MvcRazorRuntimeCompilationOptions is not working anymore
very boring and without sense.

In order to work you have to add the CompileOnRuntime and deactivate some functionalities
and activates some tricks... )-):

In past version 2.2 it was working
I'm not understanding why they changed or may be it's a bug ?

@DiegoStefanon DiegoStefanon reopened this Sep 23, 2019
@geotinc
Copy link

geotinc commented Sep 24, 2019

Same problem for me after migrating to asp.net core 3.0.
Embedded views not found...

Any workaround ?

@mkArtakMSFT mkArtakMSFT added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Sep 24, 2019
@mkArtakMSFT
Copy link
Contributor

Thanks for contacting us, @DiegoStefanon.
This is an intentional breaking change in 3.0, and is documented here: aspnet/Announcements#343

@mkArtakMSFT
Copy link
Contributor

@geotinc we have a separate issue tracking the Embedded Views issue you're facing: #14374

@nfplee
Copy link

nfplee commented Sep 27, 2019

It looks like AddMvcRazorRuntimeCompilation has been renamed to AddRazorRuntimeCompilation. I cannot comment on aspnet/Announcements#343.

@mkArtakMSFT
Copy link
Contributor

@nfplee as stated in the announcement:

Please use #7647 for further discussions or questions.

@constructor
Copy link

constructor commented Sep 29, 2019

Also same problem after migrating from core 2.2 to asp.net core 3.0.
RazorViewEngineOptions has no options.FileProviders property (by design) and using MvcRazorRuntimeCompilationOptions results in embedded views not being found.

@dario-l
Copy link

dario-l commented Sep 30, 2019

We use FileProviders to pointing out views in different modules. When Project is compiled in Release mode views are copied to the main project. We do not use compilation.

In 3.0 it is not working. Why? Why? Why?

It only works as the views compilation is enabled. Otherwise, he can't see even the paths given by ViewLocationExpanders.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates question
Projects
None yet
Development

No branches or pull requests

7 participants