0

I'm developing an ArcGIS add-in (don't worry, this is not a GIS question!) and wondered if there was an easier way to increment the version number.

At the moment, you have to edit the AssemblyVersion in AssemblyInfo.cs in both the project and the unit test project, the Config.esriaddinx (an XML file containing add-in details), and we have a config JSON file that contains a version too. So that's four places to change the version number. I know that you can use environment variables like $(VERSION) in code, but this doesn't work in AssemblyInfo.cs because version must be a constant. Also it's unlikely to work in project XML and JSON files.

Is the best approach a pre-build batch script that does a regex find and replace? Or just a script I can run from the commandline outside of visual studio. This is probably what I'll end up doing.

jon_two
  • 1,073
  • 1
  • 23
  • 34

1 Answers1

0

Visual Studio can handle this for you in it's own way. Take a look at this answer.

If this is not what you desire, you can try to search add-ins that handles this in visual studio gallery or try some open-source solution like this(I just found an example. I don't related in any way with this project).

Community
  • 1
  • 1
CodingFeles
  • 374
  • 5
  • 18
  • Thanks, but I had seen that answer and am already using wildcards to increment the build number. My problem is that I have two AssemblyInfo.cs files (project and test project) and two other project files that contain the version number. If I want to go from version 1.1 to 1.2, I have to edit four different files. Not a huge deal I know, but I just wondered if there was an easier way. – jon_two Sep 24 '15 at 09:21
  • @jon_two try solution from codeplex that I mentioned in edit. Looks like it covers your needs in more custom and multiple version handling. Of course there're way to do it as you like via build events. You can write simple batch script and call it from pre/post-build event as you said in the question. It's not a big deal, but I think premade solution like this would be more convinient. – CodingFeles Sep 24 '15 at 09:26
  • The addin might be useful, thanks. Though I'm not sure if it'll take less time configuring it than writing a script ;-) – jon_two Sep 24 '15 at 12:56
  • @jon_two each way has it's pros and cons : ) You said in question "outside of visual studio". Don't forget that basically any script can be launched from post-build events. Post-build event handler is just basically windows command line. – CodingFeles Sep 24 '15 at 14:31
  • true, but I don't want to increment the version on every build. Only when we're about to deploy some updates to our users. – jon_two Oct 01 '15 at 08:31