missingsemicolon
missingsemicolon

Reputation: 500

Use of AspNetCompiler task without targetpath

I have a question about AspNetCompiler task. My project file has the following code:

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>

I read this article https://learn.microsoft.com/en-us/aspnet/web-forms/overview/older-versions-getting-started/deploying-web-site-projects/precompiling-your-website-cs to understand why pre-compilation is required and advantages of precompiling a WSP project. These are the drawbacks of automatic compilation:

  1. Because the pages must be automatically compiled when they are first visited, there can be a short but noticeable delay when an ASP.NET page is requested for the first time after being deployed.
  2. Automatic compilation requires that both the declarative markup and source code be present on the web server. This can be an unattractive option if you plan on selling the web application to customers who will install it on their web servers.

However, one thing I cannot understand is what is the use of executing this task without specifying "TargetPath"? Where does the task stores the precompiled contents of the WSP project that helps in reducing the delay when an ASP.NET page is requested for the first time after being deployed?

Upvotes: 0

Views: 65

Answers (1)

missingsemicolon
missingsemicolon

Reputation: 500

I read about ASP Net pre-compilation again and also this article. One of the advantages of using pre-compilation is to identify compile-time bugs on markup code files (.aspx, .ashx) which does not require a targetpath. The targetpath is required only when publishing the the site to remote whe server using visual studio as explained here or to copy the precompiled version from the target location to production environment through some file copy mechanism.

Upvotes: 0

Related Questions