1
@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?

StackTrace
  • 9,190
  • 36
  • 114
  • 202
  • possible duplicate of [Compile Views in ASP.NET MVC](http://stackoverflow.com/questions/383192/compile-views-in-asp-net-mvc) – Dai Mar 05 '15 at 09:30
  • I'm afraid linked duplicate article is not related to the issue i'm having. I'm already getting compile time errors for my views. The issue i'm having is, when i pre-compile my MVC project before deployment using the "Aspnet_compiler" as in the batch script in my original post, the compiled code does not pick changes made to my views. New edits/deletions in views are not reflected in the compiled code when deployed. It's as if no change was made, whereas on a different machine, those changes are picked by the compiled code. – StackTrace Mar 05 '15 at 10:34
  • What i need is to compile .cshtml files into the Virtual path's bin folder! – StackTrace Mar 05 '15 at 11:28

1 Answers1

1

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.

StackTrace
  • 9,190
  • 36
  • 114
  • 202