Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling DLL with Version Information

What steps are needed to compile Version Information inside a windows DLL from the command line. I have been looking at VersionInfo files, but could not figure out how to link them to the DLL.

Thank you

like image 480
adk Avatar asked Apr 11 '10 20:04

adk


People also ask

How do I add Version numbers to a DLL?

For a file that is missing version info completely: After opening the DLL in Visual Studio, go to Edit > Add Resource > Version and click New. Then in the new Version tab, change FILEVERSION and PRODUCTVERSION, CompanyName, etc. Save the files and you're all set!

How do I find the DLL Version?

If you reference the dll in Visual Studio right click it (in ProjectName/References folder) and select "Properties" you have "Version" and "Runtime Version" there. In File Explorer when you right click the dll file and select properties there is a "File Version" and "Product Version" there.

How do I compile a source code into a DLL?

Start by downloading the project from GitHub. Then open the solution file in Visual Studio and make the necessary changes to the source code. Then compile. Finally reference the compiled assembly into your application (don't use the official NuGet).


1 Answers

You need to create a version resource and add it to your project. This can be very easily done from within visual studio. in VS 2008, right click a folder of the project, choose add and under "Visual C++" select "Resource File" (not resource template), in the resource file just created you'll be able to add a version resource which looks like this:

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "FileDescription", "XXX Application"
            VALUE "FileVersion", "1, 0, 0, 1"
            VALUE "InternalName", "XXX"
            VALUE "LegalCopyright", "Copyright (C) 2010"
            VALUE "OriginalFilename", "XXX.exe"
            VALUE "ProductName", "XXX Application"
            VALUE "ProductVersion", "1, 0, 0, 1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

From the command line you'll need to use rc.exe, the resource compiler and then link the result to your dll.

like image 175
shoosh Avatar answered Oct 24 '22 23:10

shoosh