0

I am precompiling my razor views in my VS publish profile by setting the following properties:

  1. Precompile options: deselect "Allow precompile site to be updatable", deselect "Emit debug information"
  2. Merge options: select "Merge all outputs to a single assembly", give name "AppCode", check "Treat as library component (remove the AppCode.compiled file).

In order to test whether my application was actually reading from the compiled views, I renamed one of my cshtml files, and tested locally. All good, the view still loaded fine indicating that the compiled view was being called.

However, when I deployed all the binaries to the server and did the same test by renaming a cshtml file, the browser responsed with server 500 error.

What am I missing please?

Rudolf Lamprecht
  • 1,050
  • 1
  • 14
  • 37
  • Look in the bin folder of your published app and find the .compiled file for your cshtml file. Inside it has a reference to the View it's expecting to use. – ShawnOrr Feb 04 '21 at 19:36
  • I know there is a reference to the file within the compiled view, but that is irrelevant. The application is supposed to read the compiled view only, and not as a reference to read the actual view. Or is my understanding incorrect? – Rudolf Lamprecht Feb 05 '21 at 04:23

1 Answers1

0

So the issue turned out to be the missing PrecompiledApp.config file that was not uploaded to the server. After uploading the file, all good.

Rudolf Lamprecht
  • 1,050
  • 1
  • 14
  • 37