Every time I publish the application in ClickOnce I get get it to update the revision number by one. Is there a way to get this change automatically to change the version number in AssemblyInfo.cs file (all our error reporting looks at the Assembly Version)?
Visual-studio – How to get the ClickOnce Publish version to match the AssemblyInfo.cs File version
clickonceversioningvisual studio
Related Topic
- C# – How to display ClickOnce Version number on Windows Forms
- .net – How to auto increment the C# assembly version via our CI platform (Hudson)
- C# – How to synchronise the publish version to the assembly version in a .NET ClickOnce application
- Visual-studio – Proper way to rename solution (and directories) in Visual Studio
- C# – How to remedy “The breakpoint will not currently be hit. No symbols have been loaded for this document.” warning
- C# – Interop type cannot be embedded
- Visual-studio – Cannot import the keyfile ‘blah.pfx’ – error ‘The keyfile may be password protected’
- Visual-studio – Error message “No exports were found that match the constraint contract name”
Best Answer
We use Team Foundation Server Team Build and have added a block to the TFSBuild.proj's
AfterCompile
target to trigger the ClickOnce publish with our preferred version number:The
PublishApplicationVersion
variable is generated by a custom MSBuild task to use the TFS Changeset number, but you could use your own custom task or an existing solution to get the version number from the AssemblyInfo file.This could theoretically be done in your project file (which is just an MSBuild script anyway), but I'd recommend against deploying from a developer machine.
I'm sure other continuous integration (CI) solutions can handle this similarly.
Edit: Sorry, got your question backwards. Going from the ClickOnce version number to the AssemblyInfo file should be doable. I'm sure the MSBuild Community Tasks (link above) have a task for updating the AssemblyInfo file, so you'd just need a custom task to pull the version number from the ClickOnce configuration XML.
However, you may also consider changing your error reporting to include the ClickOnce publish version too: