asp.net-mvcasp.net-mvc-3razoraspnet-compiler

ASP.NET Compilation Tool not compiling .cshtml files


@echo off
C:
Cd \
Cd Windows
CD Microsoft.NET
CD Framework
CD v4.0.30319
set /p phyPath= Enter Physical path in double quotes:-
set /p virPath= Enter Virtual path in double quotes:-
aspnet_compiler.exe -p %phyPath% -v / %virPath% -u
echo process completed
pause

I'm using the above script in a batch file to compile as ASP.NET MVC 3 website.When executed successfully, from one machine, all my .cshtml files are copied to the Virtual path bin directory. Also a new App_Web_********.dll file is created.

From another machine, no .cshtml are copied to the Virtual path bin folder & as a result, latest changes made in views are not reflected when the compiled code is deployed. Also a new App_Web_********.dll file is NOT CREATED

Does any one know why i could be getting this mismatch on two machines on the same source code?


Solution

  • After reviewing this link ASP.NET Compilation Tool, i removed the last -u in my script and that solved the problem.

    When you use this option, code blocks in .aspx files (that is, code located in script elements or between <% and %> tags) are not compiled. Therefore, if there are compile errors in those code blocks, you will see the error only at run time, because the .aspx file is fully compiled only then. It is generally unsafe to use this option for a site that relies on code blocks in .aspx files.