What is the correct way to precompile an ASP.Net MVC 2 application?

What is the correct way to precompile an ASP.Net MVC 2 application from Visual Studio 2010?

I am using asp.net 3.5 and trying to use the post build event.

I use this:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -v / -p "$(ProjectDir)"

but this gives me the wrong path error in ProjectDir.

UPDATE: I changed "$ (ProjectDir)" to $ (ProjectDir) \, and now it gives me this error:

"Error using a partition registered as allowDefinition = 'MachineToApplication' outside of the application tier. This error may be caused by the virtual directory not being configured as an application in IIS."

thank

+3
source share
3 answers

I had several different problems and they fixed them.

  • Post Build;

    C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -p "$ (ProjectDir)." -v/D:\Work\VSP\deploy

  • , aspx. , "hold" , . , . .

+1
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <MvcBuildViews>true</MvcBuildViews>
  </PropertyGroup>

. .

+2

Start from the absolute path and from there. What you tried usually works, although I use the property $(SolutionDir)and go from there, as I run it for many different projects.

Here is a list that may be useful.

In addition, I agree with Bugai13. You must reschedule / accept the answers.

+1
source

Source: https://habr.com/ru/post/1783713/


All Articles