Rust, 6062 bytes
fn main(){let a=include_str!("a.");print!("{}",a.len()-1)}//
What's happening is the file is including itself as a string during compiletime, and getting the length of itself.
When appended, the extra code is commented out, but still effects the length of the file.
Only works if the file name is 'a.'
Secondary Solution, 63 bytes
fn main(){let a=include_str!(file!());print!("{}",a.len()-1)}//
This solution doesn't use a hardcoded filename, losing 3 bytes1 byte.