Precompiling ASP.NET Files with Visual Studio

Compilation Guide

This procedure is an alternative to compiling your ASP.NET applications using the Veracode Visual Studio Extension.

You can use the native Microsoft Publish utility in Visual Studio to prepare binaries for a specific project in the Visual Studio solution. To precompile and deploy ASP.NET files for uploading to Veracode, you can use this procedure with Visual Studio 2005 and later. To precompile an ASP.NET application:
  1. In the Visual Studio Solution Explorer, locate the web project you want to precompile.
  2. Right-click the project and select Publish.
  3. In the Profile page, click the dropdown profile menu and select <New Profile...>.

  4. Enter a profile name and click OK.
  5. In the Connection page, from the Publish method dropdown menu, select File System.
  6. Enter the filepath where you want to publish the precompiled web files, and click Next.
  7. In the Settings page, from the Configuration dropdown menu, select the appropriate build configuration.
  8. Expand the File Publish Options menu, and select all three items.
    Note: The first item, when selected, deletes all existing files from the location you chose above. This step makes it easier for you to find the most recent DLL to upload, however, as it does delete pre-existing files, be careful when deciding the publish location.
  9. Click the Configure link in the Precompile during publishing list item.

  10. In the Advanced Precompile Settings popup:
    1. Deselect Allow precompiled site to be updateable.
    2. Select Emit debug information.
    3. Select Do not merge. Create a separate assembly for each page and control.
  11. Click OK.
  12. Click Publish to deploy the precompiled files.

You can now browse to the bin directory in the published precompiled web files folder and upload them to Veracode.

Automating the Precompilation of ASP.NET WebForms and MVC Views with MSBUILD

MSBuild scripts can automate the building of your Visual Studio solution and also interface with the Veracode Platform. You use the target folder built from the binaries to upload the .dll, .exe, and .pdb files to Veracode. You can resolve precompilation errors by looking up the errors in MSDN to prepare the application completely, including any MVC views if it is an MVC application.

For more information, read this procedure.