Any problems installing the MVC 3 rc1 file Razor cshtml Creating an action to compile?

The default default action was changed from No to Content, as I understand it, to support publishing / deploying Visual Studio.

For a specific project, I do not use the Visual Studio Publish / Deploy method and should not be compiled from the command line.

Setting the build action for "Compilation" still seems to be compiling with the addition of the benefits of compile-time errors and warnings generated for any cshtml coding errors.

This seems like a huge advantage over common runtime errors.

If I changed the build action to Compile, does anyone know what problems I will run later?

Thank you very much..

edit: I'm not sure what future issues I might run into besides deploying VS or compiling on the command line, but for security, I went for the precompile option that marcind mentions in his comment. I marked this as the closest answer.

+4
source share
1 answer

Setting your Razor files to “Compile” should not work (and I'm surprised that you say it is for you) because the files marked as “Compilation” are passed to the language compiler that matches your project types. And most Razor files are not valid C # or VB source files, and they will generate compiler errors.

It looks like VS is doing something weird and not always showing a compilation error from the IDE. However, it always crashes when compiling a project directly from the command line.

So, to answer your questions

  • Because it does not work
  • This will not work (now or later). In fact, when you publish / deploy your site, your Razor files will not be copied.

And to be technical, the “Build Action” must be “Content” because it works like publishing / deploying asp.net (and in previous previews it was “No” because VS actually knew nothing about Razor files and what default behavior, the purpose of the "change" was to make everything work at all).

+4
source

All Articles