tl;dr: How to modify the .csproj
file during publishing with ClickOnce
while executing pre-build events?
Long: I'm using TFS hosted by Microsoft for version control of my solution.
When publishing with ClickOnce
, I get the latest revision number + 1 without problems. I also can successfully write the new version number into the .csproj
file outside my build-process.
The problem is, that the .csproj
file doesn't get updated during the build process - it might be in a write-lock. I get a notification inside Notepad++ about the modification of the file, but the file still contains the old version and VS didn't notice any changes.
The only solution by now I found to resolve this issue: Move the revision update into the post-build events and add 2 instead of one to the actual revision number. Unfortunately this would cause that revision number would be out of date whenever other developers check-in code.