views:

132

answers:

4

Is there any tool which can inject into an .exe or .dll information like File Version, Product name, Copyright, etc?

I did find a tool called StampVer but it can only modify resources that are already in the file itself. I could use it but would need to modify a bunch of Visual Studio projects to include some dummy information, and I would of course prefer to avoid that.

A: 

What kind of exe/dll are you creating? There are some easy solutions for .NET assemblies, and some difficult solutions for unmanaged assemblies.

For assemblies: http://www.codeproject.com/KB/dotnet/ManagingAssemblyVersions.aspx

Not exactly after the build, but this is what we do: We create an include file for C++ from a batch file & include it in the build process. The include has a define in it that is included in the resource file.

You can also use Visual studio to modify resources in a PE ( unmanged binary ). By hand you can modify all of the version resource.

Zac
for .net assemblies I've used http://code.mattgriffith.net/UpdateVersion/
kenny
A: 

You can make a header file that would define some things like e.g. #define MAJOR_VERSION 2 and #define MINOR_VERSION 1 (same with build numbers and whatever you need there). Then, #include this header file from your .rc file.

Now, to the automation of the process. Your build script can output this header file, incrementing various values. After a successful build, the file is commited to VCS, and then can be used on next iteration. There are ways of accomplishing this even with plain .cmd files, using environment variables, however, if you can, use something more sophisticated like perl/python etc. for this task.

This works fine for producing releasable builds, and it's not the best solution if you need to increment a build number on every build you make on your development machine.

Dmitry
+1  A: 

How many projects do you have? I timed it, it takes 3 seconds in Visual Studio. Right-click project, Add, Resource, select "Version", New.

Hans Passant
Not a very practical solution for projects that are worked on in groups or built on a dedicated build machine.
John Dibling
*Do* check the changed projects back in.
Hans Passant
A: 

I ended up adding a dummy resource version and will be using StampVer.

Martin