Home > Articles > Programming > ASP .NET

📄 Contents

  1. ASP.NET Compilation
  2. Automating aspnet_compiler.exe in Visual Web Developer Express Edition
  • Print
  • + Share This
This chapter is from the book

Automating aspnet_compiler.exe in Visual Web Developer Express Edition

As I pointed out previously, there is a menu option in Visual Studio 2008 that automates the use of the aspnet_compiler.exe so that you can easily precompile your applications. That menu option does not exist in Visual Web Developer Express Edition, but you can easily add it to the menu by configuring aspnet_compiler.exe as an external tool in Visual Web Developer Express Edition.

To configure menu options for precompiling your web application in Visual Web Developer Express Edition, follow these steps:

  1. Launch Visual Web Developer Express Edition.
  2. Select Tools, External Tools to access the External Tools dialog.
  3. Type Pre-&Compile (non-updatable) in the Title text box.
  4. Click the browse button next to the Command text box and browse to aspnet_compiler.exe in the Windows\Microsoft.NET\Framework\v2.0.50727 directory.
  5. Click Open to select the aspnet_compiler.exe application.
  6. Type -p " in the Arguments text box.
  7. Click the right-facing arrow button on the right edge of the Arguments text box and select Project Directory, as shown in Figure 3.3.
    Figure 3.3

    Figure 3.3 You configure the arguments for aspnet_compiler.exe by using the menu to the right of the Arguments text box.

  8. Enter a closing quote at the end of the arguments you've entered so far. At this point, the Arguments text box should contain the following text:
    -p "$(ProjectDir)"
  9. Press the spacebar to add a space at the end of the arguments you've entered so far, and then type -v / ".
  10. Click the right-facing arrow button at the right edge of the Arguments text box again and select Project Directory.
  11. Type \..\CompiledApp" after the existing arguments. At this point, the Arguments text box should contain the following text:
    -p "$(ProjectDir)" -v / "$(ProjectDir)\..\Compiled"
  12. Check the Close on Exit check box.
  13. Click OK to add the new external tool to the list.

You now have a new menu option in Visual Web Developer Express Edition (see Figure 3.4) that enables you to precompile your web application as a non-updatable application.

Figure 3.4

Figure 3.4 Adding a menu option in Visual Web Developer Express Edition to automate the aspnet_compiler.exe utility is simple and makes it much more convenient to precompile your applications.

Now let's add a second external tool that precompiles a website and makes it updatable.

  1. Select Tools, External Tools to access the External Tools dialog.
  2. Click Add to add a new external tool.
  3. Enter Pre-Co&mpile (updatable) in the Title text box.
  4. Configure all other settings as you did before, but this time, add the -u argument to the Arguments text box. The arguments text box should contain the following text:
    -p "$(ProjectDir)" -v / "$(ProjectDir)\..\Compiled" -u

When you select one of the new menu items, your ASP.NET application is precompiled into a directory called Compiled. That directory is one level above your ASP.NET application. Therefore, if your ASP.NET application is located at c:\mysites\myWebApp, the precompiled website is saved to c:\mysites\Compiled.

  • + Share This
  • 🔖 Save To Your Account