Static members of .NET classes must be accessed using the type name, not with an instance reference. This example deploys without error because the type name of the class is used to access the static variable ID:
long dept_id #if defined pbwebform then dept_id = PBInterOp.Department.ID #end if