我正在尝试让 Visual Studio 预编译将部署在 Azure 上的 ASP.NET 应用程序。我已将以下内容添加到我的 .csproj 文件中:
<Target Name="AfterBuild">
<Message Text="Starting AspNetCompiler for $(ProjectDir)" Importance="high" />
<AspNetCompiler
VirtualPath="/"
PhysicalPath="$(ProjectDir)"
/>
</Target>
现在,当我要求 Visual Studio 准备服务包时,构建输出中将显示以下内容:
Starting AspNetCompiler for [PathToMyProject]
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p [PathToMyProject]
如果我在任何 View 文件中植入错误,该错误就会被识别出来,并会明显地破坏构建,从而执行预编译。
但是我在结果中没有看到任何新的 .NET 程序集。
如何让 ASP.NET 编译器为 View 创建 .NET 程序集?
最佳答案
如果您没有指定输出目录,您应该在此文件夹中找到输出:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\some-random-id(尝试按修改日期排序以查找最新目录)。
调用aspnet_compiler.exe时,您还可以将输出文件夹附加到命令中:
aspnet_compiler -v "/" -p "C:\Projects\WebApplication1\WebApplication1" C:\CompileOutput
在这里您可以看到我的 C:\CompiledOutput 文件夹中的输出
关于asp.net - 为什么对 aspnet_compiler 的调用不会生成新的 .NET 程序集?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12743021/