Regarding the problem of Visual Studio 2022 not publishing files without changing the number of lines in the file, here are some possible solutions:
1: Build > Clean Solution > Rebuild Solution.
2: Use the MSBuild command-line tool to publish the project directly, which can bypass some limitations of Visual Studio:
msbuild /p:DeployOnBuild=true /p:PublishProfile=YourPublishProfil
3: Run this command in the project root directory, which will update the last modified time of all files:
powershell -command: Get-ChildItem -Recurse | ForEach-Object { $_.LastWriteTime = Get-Date }
4: If none of the above solutions work, please tell me what changed between your original compilation and the new compilation?