-
Notifications
You must be signed in to change notification settings - Fork 222
ASP.NET CORE MVC Compiler Exception - View Models and HtmlHelpers in separate project #1984
Comments
Thank you for filing this issue. In order for us to investigate this issue, could you please provide a minimalistic repro project that illustrates the problem? |
https://www.dropbox.com/sh/jo2idcof91hmmjv/AABTVMQmys4WT8CNcBAwyW_ba?dl=0 Local setup is Visual Studio 2017 15.4 Open sln, build and Debug. Site returns html. Let me know of any issues with project. Thanks! |
@pranavkm, can you please look into this? Thanks! |
Any update? @pranavkm Thank you. |
I had a cursory look at running the solution in release. It worked, but I don't have Docker tools installed on my dev box and ended up removing the project from the solution and just running the web application. Does this also not work for you? |
It works when running in debug mode via visual studio. I have docker installed on windows 10. When I run in release mode it creates the image and runs in docker with host set to linux. When running that way, it errors out due to compilation of razor view. Cant find namespace or reference. I saw a similar post you commented on when having view models in seperate project. Those changes didnt work for me. The publish of the project shows it has all references. Not sure if my setup is correct for the razor view options. It seems that it doesnt take into account the ViewImports file. Not sure why it works in debug and not release. I tried a few things and no luck. Can you create a docker image and try running it that way in a linux host? |
Will do. |
@pranavkm I figured it out. Since my views are retrieved from the database as well, the compilation needed the ViewImports file. On release mode those files are compiled and not available on the root. So, I just simulated the ViewImports file as well. I didnt have to do this for the ViewStart which manages how I resolve my layouts. |
Running latest version of VS 2017, have Docker for Windows installed on Windows 10 with host set to linux
Running application via VS in debug all works fine, when running in Release mode I get compiler exceptions of the views, cant find namespace or reference. My razors views are retrieved from database and are compiled at runtime. Why is this issue happening in Release mode and not in Debug. Tried adding references in RazorViewOptions and still not working. Looked at this post and tried what was mention with Compiler callback and adding PreserveCompilationContext to true project file.
I read this post, but the changes indicated didnt work for me.
#755
The text was updated successfully, but these errors were encountered: