Answered by:
publishing Razor pages in local folder

Question
-
User-1042970710 posted
Hi Friends,
I apologize for being new to Razor pages development I am still learning, I have a question. Whenever I publish my application in release mode in a local folder the Pages folder where my application pages resides is not published... I always have to copy the Pages folder manually. How can I do it automatically? Do I need to put the Razor Pages files and their .CS files together? can I compile the .CS files and just have the .CSHTML files
Thanks.
Imran Jalali.
Monday, October 5, 2020 12:50 PM
Answers
-
User475983607 posted
jalali
Yes, I copied the published folder to IIS and It didn't worked until I copy Pages folder. Yeah I am using ASP.NET Razor Pages.ASP.NET Core Razor Pages compiles the cshtml files into a dll by default as explained above. It is possible to configure the runtime compilation as explained in the previous link. It sounds like you configure runtime compilation? If you configured runtime compilation then the cshtml files must be copied to the server.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 5, 2020 4:50 PM -
User-821857111 posted
It didn't worked until I copy Pages folder.You must have also done something else that fixed the problem. The Pages folder is not required as part of the published output. In future, if you have trouble getting the published output to run on a web server, change stdoutLogEnabled in the web.config to true, and look at the resulting log files to see what the actual problem is.- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, October 6, 2020 7:37 AM
All replies
-
User475983607 posted
jalali
Whenever I publish my application in release mode in a local folder the Pages folder where my application pages resides is not published...I assume your are asking about Core Razor Pages. The cshtml files are compiled into a dll located within the bin folder. This is the expected behavior and this information is not hidden. The official documentation explains the publish behavior.
Why are you copying the Pages folder in the first place? How did you come up with this process? Are you receiving an error after publishing the project which is causing you to copy the cshtml files?
Monday, October 5, 2020 1:04 PM -
User-1042970710 posted
mgebhard
jalali
Whenever I publish my application in release mode in a local folder the Pages folder where my application pages resides is not published...I assume your are asking about Core Razor Pages. The cshtml files are compiled into a dll located within the bin folder. This is the expected behavior and this information is not hidden. The official documentation explains the publish behavior.
Why are you copying the Pages folder in the first place? How did you come up with this process? Are you receiving an error after publishing the project which is causing you to copy the cshtml files?
Yes, I copied the published folder to IIS and It didn't worked until I copy Pages folder. Yeah I am using ASP.NET Razor Pages.
Monday, October 5, 2020 4:05 PM -
User475983607 posted
jalali
Yes, I copied the published folder to IIS and It didn't worked until I copy Pages folder. Yeah I am using ASP.NET Razor Pages.ASP.NET Core Razor Pages compiles the cshtml files into a dll by default as explained above. It is possible to configure the runtime compilation as explained in the previous link. It sounds like you configure runtime compilation? If you configured runtime compilation then the cshtml files must be copied to the server.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, October 5, 2020 4:50 PM -
User-821857111 posted
It didn't worked until I copy Pages folder.You must have also done something else that fixed the problem. The Pages folder is not required as part of the published output. In future, if you have trouble getting the published output to run on a web server, change stdoutLogEnabled in the web.config to true, and look at the resulting log files to see what the actual problem is.- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, October 6, 2020 7:37 AM