Version information in managed C++ assemblies in Visual Studio

Hello,

in a newly created managed C++ project a file named AssemblyInfo.cpp is added to the project automatically by Visual Studio. The file contains the same information than the according file in C# projects but in contrast to the C# assemblies this information is not available in the Windows explorer and all other tools that expect the version information in the traditional form (as a resource in the dll). For example the setup program we use provides the capability to overwrite a DLL during installation only if the installed DLL is of lower version than the DLL contained in the setup program. But for this to work it needs to retrieve the version information from both DLLs and it fails to do so for a standard managed C++ assembly.

The reason is that the information contained in AssemblyInfo.cpp is not automatically added as a resource to the dll (but it is for C# projects). Here  are more details.

The bottom line is that you must explicitly add a resource of type “Version” to your managed C++ project to have version information in the traditional form. The information in AssemblyInfo.cpp is used only by .NETs runtime system.

The hard part however, is to synchronize the information contained in AssemblyInfo.cpp and the resource file. There is a Visual Studio AddIn that claims to support that, but I did not try it. We use a script to build our setup-programs and this script updates version information, generates configuration files, rebuilds all affected solutions and finally invokes the installer build program. I think we will add the update of the resource file from the AssemblyInfo.cpp somewhere in this tool chain.

Best regards,
Andreas

2 Responses to “Version information in managed C++ assemblies in Visual Studio”

  1. Horst Says:

    Thanks!

  2. search engine marketing firm Says:

    For all aspects of the things you need to make up their
    internet sites is not an easy and seo conveniently.

    Website helps to create it for seo personalized transcription. Therefore, it can be used.
    Though there aren’t really suited to their business website.
    We have now mushroomed all over the course is designed professionally and effectively drawing more viewers because of an advertising
    strategy. Google Sites is a task a less-than-a-minute-long effort.

    My blog :: search engine marketing firm

Leave a Reply