Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I often find myself changing the views markup on my personal website, as they are compiled into a dll it means I have to use VS to make the changes and republish. Is it possible to have the *.cshtml files published uncompiled so I can simply edit it them on the server.

Hope this makes sense

What I have tried:

Googling and the usual stuff - why does what have you tried have to be between 30 and 50000 characters :-)
Posted
Updated 11-Nov-21 6:24am
Comments
Richard MacCutchan 11-Nov-21 11:03am    
If "What I have tried" is less than 30 characters, it probably means the poster has not tried anything. Fortunately your skills at CCC mark you out as a definite trier. :)
OriginalGriff 11-Nov-21 11:08am    
He can be very trying ... :D
pkfox 11-Nov-21 11:07am    
I notice you are 5 points ahead of OG for the last 24hrs
OriginalGriff 11-Nov-21 11:09am    
Good for him! :thumbsup:
Richard MacCutchan 11-Nov-21 11:29am    
Other way round now. :(

1 solution

Build-time and publish-time compilation of Razor files is enabled by default by the Razor SDK. When enabled, runtime compilation complements build-time compilation, allowing Razor files to be updated if they're edited.
 
Share this answer
 
Comments
pkfox 12-Nov-21 4:50am    
Hi Richard I had to add this to the csproj file - all is good now

<PropertyGroup>    <PreserveCompilationContext>true</PreserveCompilationContext>    <MvcRazorCompileOnPublish>false</MvcRazorCompileOnPublish>    <CopyRazorGenerateFilesToPublishDirectory>true</CopyRazorGenerateFilesToPublishDirectory>  </PropertyGroup>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900