ASP.NET 编译工具不编译 .cshtml 文件

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

我在批处理文件中使用上述脚本编译为 ASP.NET MVC 3 website.When 成功执行,从一台机器上,我所有的 .cshtml 文件都被复制到虚拟路径 bin目录。还会创建一个新的 App_Web_********.dll 文件。

在另一台机器上,没有 .cshtml 被复制到虚拟路径 bin 文件夹,因此,在部署编译代码时,视图中所做的最新更改不会反映出来。还有一个新的 App_Web_********.dll 文件 NOT CREATED

有谁知道为什么我在使用相同源代码的两台机器上会出现这种不匹配的情况?

查看此 link ASP.NET Compilation Tool 后,我删除了脚本中的最后一个 -u 并解决了问题。

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.