0

I have a software product which gets wrapped in a custom installer I wrote. I'd like that installer executable to be named based on the assembly it contains.

Is there any way to retrieve an assembly's version number and use it at compile time? I can't see any mention of version numbers in the macros listed in visual studio (e.g. something like $(TargetPath))..

Jon Cage
  • 36,366
  • 38
  • 137
  • 215
  • you could use a batch file to fetch the version number, and invoke it in a post-build event that renames/copies the installer executable – stijn Aug 14 '12 at 10:45
  • What command would you use on the command line to retrieve a .net assembly version? – Jon Cage Aug 14 '12 at 10:54
  • http://stackoverflow.com/questions/3037008/assembly-version-from-command-line – stijn Aug 14 '12 at 10:59
  • Doesn't appear to work: `Exception calling "LoadFrom" with "1" argument(s): "Could not load file or assembly 'file:///C:\Users\jonc\MyApp.exe' or one of its dependencies. The system cannot find the file specified." At line:1 char:39 + [System.Reflection.Assembly]::LoadFrom <<<< ("C:\Users\jonc\MyApp.exe") + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException` ...does that not work on mixed mode assemblies? – Jon Cage Aug 14 '12 at 12:33
  • sorry, no idea; I just posted it becasue it was the first match I found; another possibility is that it cannot find some dll the exe depend on.. You could try the second answer? Or parse the AssemblyVersion.cs file? – stijn Aug 14 '12 at 13:12

0 Answers0