When following the Runtime Modes documentation to get a published site running in production, i seem to still have all the views in the Views folder even when i am pre-compiling them into the site dll.
I am probably missing something simple. but i am following the docs.
The TL:DR is are the view files suppose to be there when i publish, am i missing something
So for clarity i am doing the following:
Install Umbraco 16
dotnet new install Umbraco.Templates@16.*
Create a new site
dotnet new umbraco -n PublishTest
Add the Clean starter kit to the site
cd ./PublishTest/
dotnet add package Clean
Then I run it to get it working
dotnet run
then i change the development mode models (in appsettings.development.json
)
"Runtime": {
"Mode": "Development"
},
"ModelsBuilder": {
"ModelsMode": "SourceCodeAuto"
}
then i
- restart the site
- generate the models via the back end dashboard,
- restart again to check the site is working (in development)
Now i create a appsettings.production.json
file as per the docs. i have set a http local host port to use later
{
"Umbraco": {
"CMS": {
"Runtime": {
"Mode": "Production"
},
"Hosting": {
"Debug": false
},
"Global": {
"UseHttps": true
},
"ModelsBuilder": {
"ModelsMode": "Nothing"
},
"WebRouting": {
"UmbracoApplicationUrl": "https://localhost:5003/"
},
"RuntimeMinification": {
"UseInMemoryCache": true,
"CacheBuster": "AppDomain"
}
}
}
}
then I remove the two Razor compile lines from the .csproj. so it looks like this.
<PropertyGroup>
<!-- Remove RazorCompileOnBuild and RazorCompileOnPublish when not using ModelsMode InMemoryAuto -->
<!--
<RazorCompileOnBuild>false</RazorCompileOnBuild>
<RazorCompileOnPublish>false</RazorCompileOnPublish>
-->
</PropertyGroup>
Then i build it for good measure
dotnet build -c Release
then i publish it to a folder
dotnet publish --configuration Release --output ../PublishedSite
this published site, still has a views folder with all the file in it ? is this expected
if i then go to the published folder i set a couple of things to make sure i am running in prod and can get to the site.
$Env:ASPNETCORE_ENVIRONMENT = "Production"
$Env:ASPNETCORE_HTTPS_PORTS=5003
then i run the exe out of the folder ?
.\PublishTest.exe
The site runs and is available on https://localhost:5003/umbraco
the “Live Environment” health check tells me i am running in “Production”
but i can see and edit the templates as if they are still on disk (not pre-compiled where it should tell me they are read only)
If i delete the views folder from the published site and start it up again, it just shows me null like they are not there. (so i suspect they are not).
The site still seems to work though , (as if they compiled views are there).
So summary Questions
- Should the templates appear in the views folder at all when i publish a site ?
- Am i missing something obvious in the docs
- Are the docs missing something ?
- Is v16 behaving as expected here ?