nabijaczleweli / rust-embed-resource

A Cargo build script library to handle compilation and inclusion of Windows resources, in the most resilient fashion imaginable
MIT License
166 stars 29 forks source link

build failed on vs2022 #46

Closed bigdogs closed 2 years ago

bigdogs commented 2 years ago

hi, I have a simple .rc like this, I just want to embed file version to my "dll" .

#include <winver.h>
#include <ntdef.h>

#ifdef RC_INVOKED

VS_VERSION_INFO VERSIONINFO
FILEVERSION             1,0,0,2
PRODUCTVERSION          1,0,0,2
FILEFLAGSMASK           0x3fL
FILEFLAGS               0x0L
FILEOS                  0x40004L
FILETYPE                0x2L
FILESUBTYPE             0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "080404b0"
        BEGIN
            VALUE "CompanyName", "xxx"
            VALUE "FileDescription", "xxx"
            VALUE "FileVersion", "1.0.0.2"
            VALUE "InternalName", "xxx"
            VALUE "LegalCopyright", "xxx"
            VALUE "OriginalFilename", "xxx"
            VALUE "ProductName", "xxx"
            VALUE "ProductVersion", "1.0.0.2"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x804, 1200
    END
END
#endif

it was works fine on vs2019, But after I upgrade to vs2022, the build is failed.

  --- stdout
  Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
  Copyright (C) Microsoft Corporation.  All rights reserved.

  edrdll.rc(22) : error RC2104 : undefined keyword or key name: FileDescription

  --- stderr
nabijaczleweli commented 2 years ago

Try running RC.EXE directly on your .rc file; if you get the same error, then you're in god's hands, and the bug, if any, lies elsewhere. If not, then you have found a r-e-r bug. FWIW: windres processses that file correctly.

nabijaczleweli commented 2 years ago

According to a Visual Studio user, this error occurs if you don't quote the key: image

bigdogs commented 2 years ago

According to a Visual Studio user, this error occurs if you don't quote the key: image

Thanks for pointing that out. It's encoding issue.:( my rc file was encoded with utf-8, it was works on vs2019 but not vs2022. after converting rc file to utf16, everything works fine