Pregunta

I'm building a mixed-mode assembly with C++/CLI but I can't figure out how to add standard Windows Assembly attributes like Company Name, Copyright, Product Name, Version, etc. There isn't a resource file that works like AssemblyInfo.cs does in C#. I tried Add->Resource->Version but that just gives me a standard ProjectName.rc. Anyone knows how to do this?

¿Fue útil?

Solución

It took a while to figure out, and the GUI is buggy so I finally edited it by hand. I've pasted the final contents of my ProjectName.rc that generates proper Windows Assembly Properties. You can just create an RC file and paste this into it.

If your project is an EXE project, replace FILETYPE 0x2L with FILETYPE 0x1L

#include <windows.h>

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////// 
// 
// Version
// 

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40004L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "Sample Application"
            VALUE "CompanyName", "My Company"
            VALUE "FileDescription", "My Application"
            VALUE "FileVersion", "1, 0, 0, 1"
            VALUE "InternalName", "MyProject"
            VALUE "LegalCopyright", "Copyright (C) My Company 1999"
            VALUE "OriginalFilename", "MyProject.dll"
            VALUE "ProductName", "MyProject"
            VALUE "ProductVersion", "1, 0, 0, 1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

Otros consejos

The standard rc-file will give you the standard version info, which can be seen in explorer by right-clicking the file and selecting "Properties".

enter image description here enter image description here

The assembly infos can be inserted with the assembly attributes:

[assembly:AssemblyTitleAttribute("MCPP_Console")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("??")];
[assembly:AssemblyProductAttribute("MCPP_Console")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) ?? 2014")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
[assembly:AssemblyVersionAttribute("1.0.0.0")];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top