Partager via


#pragma checksum (Visual J#) 

Applies a checksum computation between generated source files and ASPX files.

#pragma checksum "filename" "{guid}" "checksum_bytes"

Parameters

  • "filename"
    The name of the file that requires monitoring for changes or updates.
  • "{guid}"
    The globally unique identifier (GUID) for the file.
  • "checksum_bytes"
    The string of hexadecimal digits representing the bytes of the checksum. Must be an even number of hexadecimal digits. An odd number of digits results in a compile–time warning, and the directive is then ignored.

Exceptions

If the #pragma checksum directive contains improper syntax, such as missing values, the compiler displays a warning and ignores the directive.

Remarks

The Visual Studio debugger uses checksum to ensure that it always finds the right source. The compiler computes the checksum for a source file, and then emits the output to the PDB. The debugger then uses the PDB to compare against the checksum that it computes for the source file.

This solution does not work for ASP.NET projects because the computed checksum is for the generated source file, rather than the ASPX file. To address this problem, #pragma checksum provides checksum support for ASP.NET pages.

When you create an ASP.NET project in Visual J#, the generated source file contains a checksum for the .ASPX file, from which the source is generated. The compiler then writes this information into a PDB file.

If the compiler encounters no #pragma checksum directive in the file, it computes the checksum and writes the value to the PDB file.

Description

When you generate an ASP.NET project, the general source file contains the following directive at the beginning of the file.

#pragma checksum "MyFileName" "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" "XXXX...."

See Also

Other Resources

ASP.NET Programming