Skip to main content

Precompile ASP.NET Core MVC views with Visual Studio 2017 or later

You can use Veracode Static for Visual Studio to precompile and publish your ASP.NET Core web applications.

This section explains how to use the file Publish functionality in Visual Studio 2017 or later to manually produce a precompiled views DLL file. You can also automate the precompilation using the MSBuild command-line tool.

This procedure applies to precompiling an application using Visual Studio using ASP.NET Core MVC 2.0.

  1. From the Solution Explorer, right-click the web application project file and select Publish....

  2. Verify the Configuration is set to Debug.

  3. From the Publish tab of your web application, create a folder, and click Publish.

    The output folder contains the application binaries in combination with the precompiled views.

    As of ASP.NET Core 6.0, both views and application types are available in a single AppName.dll assembly. For more information, see the Microsoft documentation.

  4. After precompiling the web application, zip the folder containing the published output, and upload it to the Veracode Platform by clicking Add in the Additional Files section.

  5. Scan the folder used for the precompilation file output.