Last post Jan 27, 2018 06:29 PM by josephtherod
Jan 23, 2018 12:25 AM|josephtherod|LINK
Current App is a MVC Core Web app. I am using VS 2017 15.4 on windows 10. I have Docker for windows installed and host is set to Linux.
The web app gets its razor views from the database. I have all of this working by extending the options of the Mvc Razor engine using ViewLocation Formats, Location Expanders, and Virtual Path Provider. The app works locally in debug mode via visual studio.
It serves a page where the page, partial views, and layout are retrieved from the database. My ViewImports includes my namespaces for my custom models and helpers. My viewstart sets the respective layout from the database.
When I run the app in release mode, it spins up the docker image, via the compose and docker file. The app runs fine. When I request the page that is from the database, it fails on razor compilation exception, unable to find reference for my model and helpers.
I tried adding compiler references via the options of the razor view engine setup in my start up file, but still get the exception. Why would it work in debug mode and not release withing the docker linux hosted container?? Does it have anything do with the
content root being set correctly or my options settings in startup? Please help? Need direction if my setup is missing something in order for this to work on a linux host.
Jan 23, 2018 07:21 AM|Edward Z|LINK
>> When I run the app in release mode, it spins up the docker image, via the compose and docker file
If you run the app in release mode without docker, will it work?
It would be helpful if you could share us a simple project which could reproduce your issue.
Jan 24, 2018 02:17 AM|josephtherod|LINK
Here's the project dropbox link, https://www.dropbox.com/sh/de5a3j9e84dxjol/AAA06KVCr0Rlj2e3oIoMjawca?dl=0
The views returned are hardcoded to show you the issue. In Debug run, it returns a home page with Company Name. In Release mode, running Docker, it errors on compilation iisue of razor from db, hard coded actually. The view models and html helpers that the
razor views use are in separate projects.
I tired a few different things as you can see in the Startup.cs file. None worked for me. Local setup is Windows 10 using Visual Studio 2017. I have Docker for Windows installed with the host set to Linux,.
Jan 24, 2018 05:32 PM|josephtherod|LINK
Jan 25, 2018 06:45 AM|Edward Z|LINK
I have downloaded your project, and try to make a test with your project.
But, I got issues while debugging under Debug with Docker, it throws fail to find the project while restoring.
I am trying to fix them.
Jan 25, 2018 02:22 PM|josephtherod|LINK
here are some dlls that are not in nuget that are needed.
Let me know if still having issues building.
I think the issue is related to my view models and helpers in another project.
Jan 27, 2018 06:29 PM|josephtherod|LINK
It seems when doing the compilation the dlls are there, its the namespaces. It doesnt pull in my
ViewImports file. My ViewImports file contains the default namespaces related to my viewmodels and helpers.
Is there a way to ensure that it does?