tags:

views:

80

answers:

1

Hello *,

Is there any way to extend the information in the Windows File Version dialog. All standard attributes are already in use, in a way that I am not allowed to append additional information to them. What I need is a sort of new attribute class, which can be used as additional value shown as one of the items of File Properties/Version applet under:

Other version information:
 Item name:                    Value:
  Assembly Version              Information related to my additional attribute
  File Version
  Language
  Product Name
  Product Version
 >My Additional Attribute

Many thanks,
Ovanes

P.S. after getting an answer to work with resource editor or some command line tool, which injects additional resources I would like to clarify the current project setup. We have more than 700 assemblies. We currently use a global file AssemblyVersion.cs which is included in the compilation of every assembly. All version fields are filled there once and included during the build in all assemblies. The problem is that I have is the strict policy what they must contain. In the AssemblyVersion.cs all common (project-related) data is embedded like:

[assembly: AssemblyCopyright("My global copyright message")]

Predefined non-common fields are free to be specified in Assembly own version file. If these fields are specified there and I also put them into global AssemblyVersion.cs there will be compiler errors. Since we generate strong name assemblies hacking with resource editor will destroy the signature. Importing the resource file in all 700 assemblies might take considerable amount of time. As the best approach I see to write an own attribute class to be used like:

[assembly: MyAssemblyAttribute("Some data goes here")]

How to make this attribute show in the file version dialog?

+1  A: 

The information in the Windows File Version dialog is stored in a Version data resource as part of the Win32 EXE file. There are lots of tools (graphical and console based) that can edit resources and add new data to the version data. Maybe you can use one of the console based ones to add your information automatically after building?

Alternatively, you could create a Win32 resource with a resource compiler and try to import it during building. There's a csc option for this:

The /win32res option inserts a Win32 resource in the output file. [...]

A Win32 resource can contain version or bitmap (icon) information that would help identify your application in the Windows Explorer.

dtb
I have edited my post to explain, why it is not an option for me.
ovanes
The AssemblyCopyright attribute et al. are special attributes recognized by the compiler. You'd have to modify the compiler to recognize new attributes to be put in the version data resource. (Actually you can: the sources of the Mono C# compiler are freely available!) I think the best option is the `/win32res` option in your case.
dtb
I inspected the version structure in Visual Studio. You can't put there more fields. The only two fields which are not mapped to attributes are SpecialBuild and PrivateBuild. Can I register these fields to be set via my Assembly-level attribute? As you understand customizing the compiler is not an option ;)
ovanes
I've just tried this. You can add new version fields and they're compiled into the EXE, but they don't seem to show up in the Windows File Version dialog (I'm running Vista64). `SpecialBuild` and `PrivateBuild` don't show up as well if I they set them.
dtb
Vista seems to show only "relevant" information in the dialog. So you probably have to give up the idea of adding information to the version data resource as it won't show up anyway (except if that's okay for you).
dtb
;) I tried to set SpecialBuil and PrivateBuild in VS Resource Editor. They only show up in XP if they are not empty. If I somehow manage to tell the compiler, that my custom Attribute generates version strings for one of them I am happy. I have written some test Attribute and attached it to assembly. I can see it in Reflector than, but not in Version dialog. Probably you are right: I should drop the idea.
ovanes
.NET assembly attributes != Win32 version fields. The C# compiler does this only for a few selected assembly attributes. There is no mechanism to "register" assembly attributes to be converted to Win32 version fields.
dtb
Yes I understand, but wanted to give it a try. Anyway thanks for your devotion and time!
ovanes